-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathUnicodeDefaults.cs
More file actions
69 lines (62 loc) · 2.82 KB
/
Copy pathUnicodeDefaults.cs
File metadata and controls
69 lines (62 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.Collections.Generic;
namespace SubtitleEdit.Plugins.RemoveUnicodeCharacters;
/// <summary>
/// Built-in suggested replacements for non-ANSI characters that have a near-lossless
/// or universally understood ASCII equivalent. Used as the seed value for the
/// "Replace with" column when the user has no persisted setting for a character.
/// Debatable cases (bullets, arrows, math, trademark, music accidentals) are
/// deliberately omitted - the UI shows them blank so the user picks per row.
/// </summary>
internal static class UnicodeDefaults
{
public static readonly Dictionary<char, string> Map = new()
{
// Smart quotes -> straight ASCII quotes
['‘'] = "'", // ' left single quotation mark
['’'] = "'", // ' right single quotation mark
['‚'] = ",", // ‚ single low-9 quotation mark
['‛'] = "'", // ‛ single high-reversed-9
['“'] = "\"", // " left double quotation mark
['”'] = "\"", // " right double quotation mark
['„'] = "\"", // „ double low-9 quotation mark
['‟'] = "\"", // ‟ double high-reversed-9
// Hyphens / dashes -> hyphen-minus
['‐'] = "-", // ‐ hyphen
['‑'] = "-", // ‑ non-breaking hyphen
['‒'] = "-", // ‒ figure dash
['–'] = "-", // – en dash
['—'] = "-", // — em dash
['―'] = "-", // ― horizontal bar
['−'] = "-", // − minus sign
// Ellipses / dot leaders
['․'] = ".", // ․ one-dot leader
['‥'] = "..", // ‥ two-dot leader
['…'] = "...", // … horizontal ellipsis
// Music notes (note heads, not accidentals)
['♩'] = "#", // ♩ quarter note
['♪'] = "#", // ♪ eighth note
['♫'] = "#", // ♫ beamed eighth notes
['♬'] = "#", // ♬ beamed sixteenth notes
// Wide / narrow space variants -> regular space
[' '] = " ", // en quad
[' '] = " ", // em quad
[' '] = " ", // en space
[' '] = " ", // em space
[' '] = " ", // three-per-em space
[' '] = " ", // four-per-em space
[' '] = " ", // six-per-em space
[' '] = " ", // figure space
[' '] = " ", // punctuation space
[' '] = " ", // thin space
[' '] = " ", // hair space
[' '] = " ", // narrow no-break space
[' '] = " ", // medium mathematical space
[' '] = " ", // ideographic space
// Zero-width and joiner controls -> remove
[''] = "", // zero-width space
[''] = "", // zero-width non-joiner
[''] = "", // zero-width joiner
[''] = "", // word joiner
[''] = "", // zero-width no-break space / BOM
};
}