| author | |
| committer | |
| log | 0072865f1e40ae053ab43589bfc27735ce84cf84 |
| tree | f27da67c0d16c54e1aea9fbb95c2fbc330073711 |
| parent | ba472f055e4e641958202b0229ef52a8c5193d8b |
2 files changed, 7 insertions(+), 0 deletions(-)
idna.zig+4| ... | ... | @@ -8,6 +8,7 @@ pub const @"2008" = @import("./2008.zig"); |
| 8 | 8 | |
| 9 | 9 | pub const table = @import("./table.zig"); |
| 10 | 10 | |
| 11 | // https://unicode.org/reports/tr46/#ToASCII | |
| 11 | 12 | pub fn ToASCII( |
| 12 | 13 | allocator: std.mem.Allocator, |
| 13 | 14 | domain_name: []const u8, |
| ... | ... | @@ -44,6 +45,7 @@ pub fn ToASCII( |
| 44 | 45 | return map.toOwnedSlice(); |
| 45 | 46 | } |
| 46 | 47 | |
| 48 | // https://unicode.org/reports/tr46/#ToUnicode | |
| 47 | 49 | pub fn ToUnicode( |
| 48 | 50 | allocator: std.mem.Allocator, |
| 49 | 51 | domain_name: []const u8, |
| ... | ... | @@ -60,6 +62,7 @@ pub fn ToUnicode( |
| 60 | 62 | return map.toOwnedSlice(); |
| 61 | 63 | } |
| 62 | 64 | |
| 65 | // https://unicode.org/reports/tr46/#Processing | |
| 63 | 66 | fn Processing( |
| 64 | 67 | map: *extras.ManyArrayList(u8), |
| 65 | 68 | domain_name: []const u8, |
| ... | ... | @@ -166,6 +169,7 @@ fn isNFC(map: *const extras.ManyArrayList(u8)) bool { |
| 166 | 169 | return false; |
| 167 | 170 | } |
| 168 | 171 | |
| 172 | // https://unicode.org/reports/tr46/#Validity_Criteria | |
| 169 | 173 | fn Validity_Criteria( |
| 170 | 174 | label: []const u8, |
| 171 | 175 | CheckHyphens: bool, |
normalization.zig+3| ... | ... | @@ -41,6 +41,7 @@ pub fn ToNFKC(map: *extras.ManyArrayList(u8)) !void { |
| 41 | 41 | try CanonicalComposition(map); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | // https://www.unicode.org/versions/latest/core-spec/chapter-3/#G733 | |
| 44 | 45 | fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compatibility }) !void { |
| 45 | 46 | // fully decompose all codepoints in the string |
| 46 | 47 | var n: usize = 0; |
| ... | ... | @@ -101,6 +102,7 @@ fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compati |
| 101 | 102 | } |
| 102 | 103 | } |
| 103 | 104 | |
| 105 | // https://www.unicode.org/versions/latest/core-spec/chapter-3/#G50628 | |
| 104 | 106 | fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void { |
| 105 | 107 | if (map.lengths.items.len < 2) { |
| 106 | 108 | return; |
| ... | ... | @@ -157,6 +159,7 @@ fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void { |
| 157 | 159 | break; |
| 158 | 160 | } |
| 159 | 161 | } |
| 162 | // https://www.unicode.org/versions/latest/core-spec/chapter-3/#G56669 | |
| 160 | 163 | i = 0; |
| 161 | 164 | while (i < map.lengths.items.len) : (i += 1) { |
| 162 | 165 | const sll = map.items(i); |