PureXML/Sources/Parsing/EUCTWTable.swift
Mihaela Mihaljevic 56e889f790 feat(parsing): EUC-TW (CNS 11643) decoding, closing #108
Add EUC-TW for the whole-buffer and streaming decoders: ASCII, a two-byte
plane-1 pair, and a 0x8E four-byte plane selector plus a pair. CNS planes 1
and 2, which carry essentially all real-world EUC-TW text, are vendored from
the ICU euc-tw-2014 mapping (private-use fallbacks dropped); planes 3-15 are a
documented follow-up. Tested for plane 1 (two-byte and four-byte forms), plane
2, and streaming. The streaming method moved to its own file to stay under the
type-body cap.

Closes #108
2026-06-09 17:44:22 +02:00

9 lines
552 B
Swift

extension PureXML.Parsing.ByteDecoder {
/// CNS 11643 plane 1 and plane 2, the planes that carry essentially all
/// real-world EUC-TW text, indexed by `(b1-0xA1)*94 + (b2-0xA1)`. A `0` entry
/// is unmapped. Vendored from the ICU `euc-tw-2014` mapping (private-use
/// fallbacks dropped); reproduce from that file. Planes 3-15 are not vendored.
static let eucTWPlane1: [UInt32] = eucTWPlane1Part1 + eucTWPlane1Part2 + eucTWPlane1Part3
static let eucTWPlane2: [UInt32] = eucTWPlane2Part1 + eucTWPlane2Part2 + eucTWPlane2Part3
}