diff options
author | bptato <nincsnevem662@gmail.com> | 2023-05-20 01:06:46 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-05-20 01:06:56 +0200 |
commit | a3a3563a2cecce3b8091252e37d55bf07c123f48 (patch) | |
tree | 968372d2ff14630e7681eb9f8517ff647fd64e94 /src/data | |
parent | 26e8968a6499742cf37e00292a7d1c8ed620cad5 (diff) | |
download | chawan-a3a3563a2cecce3b8091252e37d55bf07c123f48.tar.gz |
Support all whatwg encodings
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/charset.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/data/charset.nim b/src/data/charset.nim index 45d7786c..560e8643 100644 --- a/src/data/charset.nim +++ b/src/data/charset.nim @@ -407,6 +407,12 @@ func loadCharsetMap16(path: string, len: static uint16): tuple[ result.encode.add((uint16(n), uint16(index))) result.encode.sort() +func loadCharsetMapSJIS(path: string): seq[UCS16x16] = + for index, n in mappairs("res/map" / path): + if n notin 8272..8835: + result.add((uint16(n), uint16(index))) + result.sort() + type UCS32x16* = tuple[ucs: uint32, p: uint16] func loadBig5Map(path: string, offset: static uint16): tuple[ @@ -451,6 +457,7 @@ const (Gb18030Decode*, Gb18030Encode*) = loadCharsetMap16("index-gb18030.txt", l const Big5DecodeOffset* = 942 const (Big5Decode*, Big5Encode*) = loadBig5Map("index-big5.txt", offset = Big5DecodeOffset) const (Jis0208Decode*, Jis0208Encode*) = loadCharsetMap16("index-jis0208.txt", len = 11104) +const ShiftJISEncode* = loadCharsetMapSJIS("index-jis0208.txt") const (Jis0212Decode*, Jis0212Encode*) = loadCharsetMap16("index-jis0212.txt", len = 7211) const ISO2022JPKatakanaEncode* = loadCharsetMap8Encode("index-iso-2022-jp-katakana.txt") const (EUCKRDecode*, EUCKREncode*) = loadCharsetMap16("index-euc-kr.txt", len = 23750) |