diff options
author | Wim <wim@42.be> | 2018-05-11 21:54:32 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-05-11 21:54:32 +0200 |
commit | bf0b9959d1b81d6362a390baaee70f2102fb2d58 (patch) | |
tree | 61f2e71367884883cb9f68d7ac55cdcbb5dce908 /vendor/golang.org/x/text/encoding | |
parent | 406a54b597271add1e297231e6f260895eff8f1d (diff) | |
download | matterbridge-msglm-bf0b9959d1b81d6362a390baaee70f2102fb2d58.tar.gz matterbridge-msglm-bf0b9959d1b81d6362a390baaee70f2102fb2d58.tar.bz2 matterbridge-msglm-bf0b9959d1b81d6362a390baaee70f2102fb2d58.zip |
Add vendor github.com/dfordsoft/golib/ic
Diffstat (limited to 'vendor/golang.org/x/text/encoding')
18 files changed, 3213 insertions, 298 deletions
diff --git a/vendor/golang.org/x/text/encoding/charmap/charmap.go b/vendor/golang.org/x/text/encoding/charmap/charmap.go index 6e62a837..e89ff073 100644 --- a/vendor/golang.org/x/text/encoding/charmap/charmap.go +++ b/vendor/golang.org/x/text/encoding/charmap/charmap.go @@ -33,32 +33,32 @@ var ( ISO8859_8I encoding.Encoding = &iso8859_8I iso8859_6E = internal.Encoding{ - ISO8859_6, - "ISO-8859-6E", - identifier.ISO88596E, + Encoding: ISO8859_6, + Name: "ISO-8859-6E", + MIB: identifier.ISO88596E, } iso8859_6I = internal.Encoding{ - ISO8859_6, - "ISO-8859-6I", - identifier.ISO88596I, + Encoding: ISO8859_6, + Name: "ISO-8859-6I", + MIB: identifier.ISO88596I, } iso8859_8E = internal.Encoding{ - ISO8859_8, - "ISO-8859-8E", - identifier.ISO88598E, + Encoding: ISO8859_8, + Name: "ISO-8859-8E", + MIB: identifier.ISO88598E, } iso8859_8I = internal.Encoding{ - ISO8859_8, - "ISO-8859-8I", - identifier.ISO88598I, + Encoding: ISO8859_8, + Name: "ISO-8859-8I", + MIB: identifier.ISO88598I, } ) // All is a list of all defined encodings in this package. -var All = listAll +var All []encoding.Encoding = listAll // TODO: implement these encodings, in order of importance. // ASCII, ISO8859_1: Rather common. Close to Windows 1252. @@ -70,8 +70,8 @@ type utf8Enc struct { data [3]byte } -// charmap describes an 8-bit character set encoding. -type charmap struct { +// Charmap is an 8-bit character set encoding. +type Charmap struct { // name is the encoding's name. name string // mib is the encoding type of this encoder. @@ -79,7 +79,7 @@ type charmap struct { // asciiSuperset states whether the encoding is a superset of ASCII. asciiSuperset bool // low is the lower bound of the encoded byte for a non-ASCII rune. If - // charmap.asciiSuperset is true then this will be 0x80, otherwise 0x00. + // Charmap.asciiSuperset is true then this will be 0x80, otherwise 0x00. low uint8 // replacement is the encoded replacement character. replacement byte @@ -91,26 +91,30 @@ type charmap struct { encode [256]uint32 } -func (m *charmap) NewDecoder() *encoding.Decoder { +// NewDecoder implements the encoding.Encoding interface. +func (m *Charmap) NewDecoder() *encoding.Decoder { return &encoding.Decoder{Transformer: charmapDecoder{charmap: m}} } -func (m *charmap) NewEncoder() *encoding.Encoder { +// NewEncoder implements the encoding.Encoding interface. +func (m *Charmap) NewEncoder() *encoding.Encoder { return &encoding.Encoder{Transformer: charmapEncoder{charmap: m}} } -func (m *charmap) String() string { +// String returns the Charmap's name. +func (m *Charmap) String() string { return m.name } -func (m *charmap) ID() (mib identifier.MIB, other string) { +// ID implements an internal interface. +func (m *Charmap) ID() (mib identifier.MIB, other string) { return m.mib, "" } // charmapDecoder implements transform.Transformer by decoding to UTF-8. type charmapDecoder struct { transform.NopResetter - charmap *charmap + charmap *Charmap } func (m charmapDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -142,10 +146,22 @@ func (m charmapDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, return nDst, nSrc, err } +// DecodeByte returns the Charmap's rune decoding of the byte b. +func (m *Charmap) DecodeByte(b byte) rune { + switch x := &m.decode[b]; x.len { + case 1: + return rune(x.data[0]) + case 2: + return rune(x.data[0]&0x1f)<<6 | rune(x.data[1]&0x3f) + default: + return rune(x.data[0]&0x0f)<<12 | rune(x.data[1]&0x3f)<<6 | rune(x.data[2]&0x3f) + } +} + // charmapEncoder implements transform.Transformer by encoding from UTF-8. type charmapEncoder struct { transform.NopResetter - charmap *charmap + charmap *Charmap } func (m charmapEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -207,3 +223,27 @@ loop: } return nDst, nSrc, err } + +// EncodeRune returns the Charmap's byte encoding of the rune r. ok is whether +// r is in the Charmap's repertoire. If not, b is set to the Charmap's +// replacement byte. This is often the ASCII substitute character '\x1a'. +func (m *Charmap) EncodeRune(r rune) (b byte, ok bool) { + if r < utf8.RuneSelf && m.asciiSuperset { + return byte(r), true + } + for low, high := int(m.low), 0x100; ; { + if low >= high { + return m.replacement, false + } + mid := (low + high) / 2 + got := m.encode[mid] + gotRune := rune(got & (1<<24 - 1)) + if gotRune < r { + low = mid + 1 + } else if gotRune > r { + high = mid + } else { + return byte(got >> 24), true + } + } +} diff --git a/vendor/golang.org/x/text/encoding/charmap/maketables.go b/vendor/golang.org/x/text/encoding/charmap/maketables.go index a691acb1..f7941701 100644 --- a/vendor/golang.org/x/text/encoding/charmap/maketables.go +++ b/vendor/golang.org/x/text/encoding/charmap/maketables.go @@ -494,7 +494,7 @@ func main() { if e.comment != "" { printf("//\n// %s\n", e.comment) } - printf("var %s encoding.Encoding = &%s\n\nvar %s = charmap{\nname: %q,\n", + printf("var %s *Charmap = &%s\n\nvar %s = Charmap{\nname: %q,\n", varName, lowerVarName, lowerVarName, e.name) if mibs[e.mib] { log.Fatalf("MIB type %q declared multiple times.", e.mib) @@ -540,7 +540,7 @@ func main() { } printf("},\n}\n") - // Add an estimate of the size of a single charmap{} struct value, which + // Add an estimate of the size of a single Charmap{} struct value, which // includes two 256 elem arrays of 4 bytes and some extra fields, which // align to 3 uint64s on 64-bit architectures. w.Size += 2*4*256 + 3*8 diff --git a/vendor/golang.org/x/text/encoding/charmap/tables.go b/vendor/golang.org/x/text/encoding/charmap/tables.go index e36cd7ad..cf7281e9 100644 --- a/vendor/golang.org/x/text/encoding/charmap/tables.go +++ b/vendor/golang.org/x/text/encoding/charmap/tables.go @@ -1,4 +1,4 @@ -// This file was generated by go generate; DO NOT EDIT +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. package charmap @@ -8,9 +8,9 @@ import ( ) // CodePage037 is the IBM Code Page 037 encoding. -var CodePage037 encoding.Encoding = &codePage037 +var CodePage037 *Charmap = &codePage037 -var codePage037 = charmap{ +var codePage037 = Charmap{ name: "IBM Code Page 037", mib: identifier.IBM037, asciiSuperset: false, @@ -183,9 +183,9 @@ var codePage037 = charmap{ } // CodePage437 is the IBM Code Page 437 encoding. -var CodePage437 encoding.Encoding = &codePage437 +var CodePage437 *Charmap = &codePage437 -var codePage437 = charmap{ +var codePage437 = Charmap{ name: "IBM Code Page 437", mib: identifier.PC8CodePage437, asciiSuperset: true, @@ -358,9 +358,9 @@ var codePage437 = charmap{ } // CodePage850 is the IBM Code Page 850 encoding. -var CodePage850 encoding.Encoding = &codePage850 +var CodePage850 *Charmap = &codePage850 -var codePage850 = charmap{ +var codePage850 = Charmap{ name: "IBM Code Page 850", mib: identifier.PC850Multilingual, asciiSuperset: true, @@ -533,9 +533,9 @@ var codePage850 = charmap{ } // CodePage852 is the IBM Code Page 852 encoding. -var CodePage852 encoding.Encoding = &codePage852 +var CodePage852 *Charmap = &codePage852 -var codePage852 = charmap{ +var codePage852 = Charmap{ name: "IBM Code Page 852", mib: identifier.PCp852, asciiSuperset: true, @@ -708,9 +708,9 @@ var codePage852 = charmap{ } // CodePage855 is the IBM Code Page 855 encoding. -var CodePage855 encoding.Encoding = &codePage855 +var CodePage855 *Charmap = &codePage855 -var codePage855 = charmap{ +var codePage855 = Charmap{ name: "IBM Code Page 855", mib: identifier.IBM855, asciiSuperset: true, @@ -883,9 +883,9 @@ var codePage855 = charmap{ } // CodePage858 is the Windows Code Page 858 encoding. -var CodePage858 encoding.Encoding = &codePage858 +var CodePage858 *Charmap = &codePage858 -var codePage858 = charmap{ +var codePage858 = Charmap{ name: "Windows Code Page 858", mib: identifier.IBM00858, asciiSuperset: true, @@ -1058,9 +1058,9 @@ var codePage858 = charmap{ } // CodePage860 is the IBM Code Page 860 encoding. -var CodePage860 encoding.Encoding = &codePage860 +var CodePage860 *Charmap = &codePage860 -var codePage860 = charmap{ +var codePage860 = Charmap{ name: "IBM Code Page 860", mib: identifier.IBM860, asciiSuperset: true, @@ -1233,9 +1233,9 @@ var codePage860 = charmap{ } // CodePage862 is the IBM Code Page 862 encoding. -var CodePage862 encoding.Encoding = &codePage862 +var CodePage862 *Charmap = &codePage862 -var codePage862 = charmap{ +var codePage862 = Charmap{ name: "IBM Code Page 862", mib: identifier.PC862LatinHebrew, asciiSuperset: true, @@ -1408,9 +1408,9 @@ var codePage862 = charmap{ } // CodePage863 is the IBM Code Page 863 encoding. -var CodePage863 encoding.Encoding = &codePage863 +var CodePage863 *Charmap = &codePage863 -var codePage863 = charmap{ +var codePage863 = Charmap{ name: "IBM Code Page 863", mib: identifier.IBM863, asciiSuperset: true, @@ -1583,9 +1583,9 @@ var codePage863 = charmap{ } // CodePage865 is the IBM Code Page 865 encoding. -var CodePage865 encoding.Encoding = &codePage865 +var CodePage865 *Charmap = &codePage865 -var codePage865 = charmap{ +var codePage865 = Charmap{ name: "IBM Code Page 865", mib: identifier.IBM865, asciiSuperset: true, @@ -1758,9 +1758,9 @@ var codePage865 = charmap{ } // CodePage866 is the IBM Code Page 866 encoding. -var CodePage866 encoding.Encoding = &codePage866 +var CodePage866 *Charmap = &codePage866 -var codePage866 = charmap{ +var codePage866 = Charmap{ name: "IBM Code Page 866", mib: identifier.IBM866, asciiSuperset: true, @@ -1933,9 +1933,9 @@ var codePage866 = charmap{ } // CodePage1047 is the IBM Code Page 1047 encoding. -var CodePage1047 encoding.Encoding = &codePage1047 +var CodePage1047 *Charmap = &codePage1047 -var codePage1047 = charmap{ +var codePage1047 = Charmap{ name: "IBM Code Page 1047", mib: identifier.IBM1047, asciiSuperset: false, @@ -2108,9 +2108,9 @@ var codePage1047 = charmap{ } // CodePage1140 is the IBM Code Page 1140 encoding. -var CodePage1140 encoding.Encoding = &codePage1140 +var CodePage1140 *Charmap = &codePage1140 -var codePage1140 = charmap{ +var codePage1140 = Charmap{ name: "IBM Code Page 1140", mib: identifier.IBM01140, asciiSuperset: false, @@ -2283,9 +2283,9 @@ var codePage1140 = charmap{ } // ISO8859_1 is the ISO 8859-1 encoding. -var ISO8859_1 encoding.Encoding = &iso8859_1 +var ISO8859_1 *Charmap = &iso8859_1 -var iso8859_1 = charmap{ +var iso8859_1 = Charmap{ name: "ISO 8859-1", mib: identifier.ISOLatin1, asciiSuperset: true, @@ -2458,9 +2458,9 @@ var iso8859_1 = charmap{ } // ISO8859_2 is the ISO 8859-2 encoding. -var ISO8859_2 encoding.Encoding = &iso8859_2 +var ISO8859_2 *Charmap = &iso8859_2 -var iso8859_2 = charmap{ +var iso8859_2 = Charmap{ name: "ISO 8859-2", mib: identifier.ISOLatin2, asciiSuperset: true, @@ -2633,9 +2633,9 @@ var iso8859_2 = charmap{ } // ISO8859_3 is the ISO 8859-3 encoding. -var ISO8859_3 encoding.Encoding = &iso8859_3 +var ISO8859_3 *Charmap = &iso8859_3 -var iso8859_3 = charmap{ +var iso8859_3 = Charmap{ name: "ISO 8859-3", mib: identifier.ISOLatin3, asciiSuperset: true, @@ -2808,9 +2808,9 @@ var iso8859_3 = charmap{ } // ISO8859_4 is the ISO 8859-4 encoding. -var ISO8859_4 encoding.Encoding = &iso8859_4 +var ISO8859_4 *Charmap = &iso8859_4 -var iso8859_4 = charmap{ +var iso8859_4 = Charmap{ name: "ISO 8859-4", mib: identifier.ISOLatin4, asciiSuperset: true, @@ -2983,9 +2983,9 @@ var iso8859_4 = charmap{ } // ISO8859_5 is the ISO 8859-5 encoding. -var ISO8859_5 encoding.Encoding = &iso8859_5 +var ISO8859_5 *Charmap = &iso8859_5 -var iso8859_5 = charmap{ +var iso8859_5 = Charmap{ name: "ISO 8859-5", mib: identifier.ISOLatinCyrillic, asciiSuperset: true, @@ -3158,9 +3158,9 @@ var iso8859_5 = charmap{ } // ISO8859_6 is the ISO 8859-6 encoding. -var ISO8859_6 encoding.Encoding = &iso8859_6 +var ISO8859_6 *Charmap = &iso8859_6 -var iso8859_6 = charmap{ +var iso8859_6 = Charmap{ name: "ISO 8859-6", mib: identifier.ISOLatinArabic, asciiSuperset: true, @@ -3333,9 +3333,9 @@ var iso8859_6 = charmap{ } // ISO8859_7 is the ISO 8859-7 encoding. -var ISO8859_7 encoding.Encoding = &iso8859_7 +var ISO8859_7 *Charmap = &iso8859_7 -var iso8859_7 = charmap{ +var iso8859_7 = Charmap{ name: "ISO 8859-7", mib: identifier.ISOLatinGreek, asciiSuperset: true, @@ -3508,9 +3508,9 @@ var iso8859_7 = charmap{ } // ISO8859_8 is the ISO 8859-8 encoding. -var ISO8859_8 encoding.Encoding = &iso8859_8 +var ISO8859_8 *Charmap = &iso8859_8 -var iso8859_8 = charmap{ +var iso8859_8 = Charmap{ name: "ISO 8859-8", mib: identifier.ISOLatinHebrew, asciiSuperset: true, @@ -3683,9 +3683,9 @@ var iso8859_8 = charmap{ } // ISO8859_9 is the ISO 8859-9 encoding. -var ISO8859_9 encoding.Encoding = &iso8859_9 +var ISO8859_9 *Charmap = &iso8859_9 -var iso8859_9 = charmap{ +var iso8859_9 = Charmap{ name: "ISO 8859-9", mib: identifier.ISOLatin5, asciiSuperset: true, @@ -3858,9 +3858,9 @@ var iso8859_9 = charmap{ } // ISO8859_10 is the ISO 8859-10 encoding. -var ISO8859_10 encoding.Encoding = &iso8859_10 +var ISO8859_10 *Charmap = &iso8859_10 -var iso8859_10 = charmap{ +var iso8859_10 = Charmap{ name: "ISO 8859-10", mib: identifier.ISOLatin6, asciiSuperset: true, @@ -4033,9 +4033,9 @@ var iso8859_10 = charmap{ } // ISO8859_13 is the ISO 8859-13 encoding. -var ISO8859_13 encoding.Encoding = &iso8859_13 +var ISO8859_13 *Charmap = &iso8859_13 -var iso8859_13 = charmap{ +var iso8859_13 = Charmap{ name: "ISO 8859-13", mib: identifier.ISO885913, asciiSuperset: true, @@ -4208,9 +4208,9 @@ var iso8859_13 = charmap{ } // ISO8859_14 is the ISO 8859-14 encoding. -var ISO8859_14 encoding.Encoding = &iso8859_14 +var ISO8859_14 *Charmap = &iso8859_14 -var iso8859_14 = charmap{ +var iso8859_14 = Charmap{ name: "ISO 8859-14", mib: identifier.ISO885914, asciiSuperset: true, @@ -4383,9 +4383,9 @@ var iso8859_14 = charmap{ } // ISO8859_15 is the ISO 8859-15 encoding. -var ISO8859_15 encoding.Encoding = &iso8859_15 +var ISO8859_15 *Charmap = &iso8859_15 -var iso8859_15 = charmap{ +var iso8859_15 = Charmap{ name: "ISO 8859-15", mib: identifier.ISO885915, asciiSuperset: true, @@ -4558,9 +4558,9 @@ var iso8859_15 = charmap{ } // ISO8859_16 is the ISO 8859-16 encoding. -var ISO8859_16 encoding.Encoding = &iso8859_16 +var ISO8859_16 *Charmap = &iso8859_16 -var iso8859_16 = charmap{ +var iso8859_16 = Charmap{ name: "ISO 8859-16", mib: identifier.ISO885916, asciiSuperset: true, @@ -4733,9 +4733,9 @@ var iso8859_16 = charmap{ } // KOI8R is the KOI8-R encoding. -var KOI8R encoding.Encoding = &koi8R +var KOI8R *Charmap = &koi8R -var koi8R = charmap{ +var koi8R = Charmap{ name: "KOI8-R", mib: identifier.KOI8R, asciiSuperset: true, @@ -4908,9 +4908,9 @@ var koi8R = charmap{ } // KOI8U is the KOI8-U encoding. -var KOI8U encoding.Encoding = &koi8U +var KOI8U *Charmap = &koi8U -var koi8U = charmap{ +var koi8U = Charmap{ name: "KOI8-U", mib: identifier.KOI8U, asciiSuperset: true, @@ -5083,9 +5083,9 @@ var koi8U = charmap{ } // Macintosh is the Macintosh encoding. -var Macintosh encoding.Encoding = &macintosh +var Macintosh *Charmap = &macintosh -var macintosh = charmap{ +var macintosh = Charmap{ name: "Macintosh", mib: identifier.Macintosh, asciiSuperset: true, @@ -5258,9 +5258,9 @@ var macintosh = charmap{ } // MacintoshCyrillic is the Macintosh Cyrillic encoding. -var MacintoshCyrillic encoding.Encoding = &macintoshCyrillic +var MacintoshCyrillic *Charmap = &macintoshCyrillic -var macintoshCyrillic = charmap{ +var macintoshCyrillic = Charmap{ name: "Macintosh Cyrillic", mib: identifier.MacintoshCyrillic, asciiSuperset: true, @@ -5433,9 +5433,9 @@ var macintoshCyrillic = charmap{ } // Windows874 is the Windows 874 encoding. -var Windows874 encoding.Encoding = &windows874 +var Windows874 *Charmap = &windows874 -var windows874 = charmap{ +var windows874 = Charmap{ name: "Windows 874", mib: identifier.Windows874, asciiSuperset: true, @@ -5608,9 +5608,9 @@ var windows874 = charmap{ } // Windows1250 is the Windows 1250 encoding. -var Windows1250 encoding.Encoding = &windows1250 +var Windows1250 *Charmap = &windows1250 -var windows1250 = charmap{ +var windows1250 = Charmap{ name: "Windows 1250", mib: identifier.Windows1250, asciiSuperset: true, @@ -5783,9 +5783,9 @@ var windows1250 = charmap{ } // Windows1251 is the Windows 1251 encoding. -var Windows1251 encoding.Encoding = &windows1251 +var Windows1251 *Charmap = &windows1251 -var windows1251 = charmap{ +var windows1251 = Charmap{ name: "Windows 1251", mib: identifier.Windows1251, asciiSuperset: true, @@ -5958,9 +5958,9 @@ var windows1251 = charmap{ } // Windows1252 is the Windows 1252 encoding. -var Windows1252 encoding.Encoding = &windows1252 +var Windows1252 *Charmap = &windows1252 -var windows1252 = charmap{ +var windows1252 = Charmap{ name: "Windows 1252", mib: identifier.Windows1252, asciiSuperset: true, @@ -6133,9 +6133,9 @@ var windows1252 = charmap{ } // Windows1253 is the Windows 1253 encoding. -var Windows1253 encoding.Encoding = &windows1253 +var Windows1253 *Charmap = &windows1253 -var windows1253 = charmap{ +var windows1253 = Charmap{ name: "Windows 1253", mib: identifier.Windows1253, asciiSuperset: true, @@ -6308,9 +6308,9 @@ var windows1253 = charmap{ } // Windows1254 is the Windows 1254 encoding. -var Windows1254 encoding.Encoding = &windows1254 +var Windows1254 *Charmap = &windows1254 -var windows1254 = charmap{ +var windows1254 = Charmap{ name: "Windows 1254", mib: identifier.Windows1254, asciiSuperset: true, @@ -6483,9 +6483,9 @@ var windows1254 = charmap{ } // Windows1255 is the Windows 1255 encoding. -var Windows1255 encoding.Encoding = &windows1255 +var Windows1255 *Charmap = &windows1255 -var windows1255 = charmap{ +var windows1255 = Charmap{ name: "Windows 1255", mib: identifier.Windows1255, asciiSuperset: true, @@ -6593,7 +6593,7 @@ var windows1255 = charmap{ {2, [3]byte{0xd6, 0xb4, 0x00}}, {2, [3]byte{0xd6, 0xb5, 0x00}}, {2, [3]byte{0xd6, 0xb6, 0x00}}, {2, [3]byte{0xd6, 0xb7, 0x00}}, {2, [3]byte{0xd6, 0xb8, 0x00}}, {2, [3]byte{0xd6, 0xb9, 0x00}}, - {3, [3]byte{0xef, 0xbf, 0xbd}}, {2, [3]byte{0xd6, 0xbb, 0x00}}, + {2, [3]byte{0xd6, 0xba, 0x00}}, {2, [3]byte{0xd6, 0xbb, 0x00}}, {2, [3]byte{0xd6, 0xbc, 0x00}}, {2, [3]byte{0xd6, 0xbd, 0x00}}, {2, [3]byte{0xd6, 0xbe, 0x00}}, {2, [3]byte{0xd6, 0xbf, 0x00}}, {2, [3]byte{0xd7, 0x80, 0x00}}, {2, [3]byte{0xd7, 0x81, 0x00}}, @@ -6643,24 +6643,24 @@ var windows1255 = charmap{ 0xb20000b2, 0xb30000b3, 0xb40000b4, 0xb50000b5, 0xb60000b6, 0xb70000b7, 0xb80000b8, 0xb90000b9, 0xbb0000bb, 0xbc0000bc, 0xbd0000bd, 0xbe0000be, 0xbf0000bf, 0xaa0000d7, 0xba0000f7, 0x83000192, 0x880002c6, 0x980002dc, 0xc00005b0, 0xc10005b1, 0xc20005b2, 0xc30005b3, 0xc40005b4, 0xc50005b5, - 0xc60005b6, 0xc70005b7, 0xc80005b8, 0xc90005b9, 0xcb0005bb, 0xcc0005bc, 0xcd0005bd, 0xce0005be, - 0xcf0005bf, 0xd00005c0, 0xd10005c1, 0xd20005c2, 0xd30005c3, 0xe00005d0, 0xe10005d1, 0xe20005d2, - 0xe30005d3, 0xe40005d4, 0xe50005d5, 0xe60005d6, 0xe70005d7, 0xe80005d8, 0xe90005d9, 0xea0005da, - 0xeb0005db, 0xec0005dc, 0xed0005dd, 0xee0005de, 0xef0005df, 0xf00005e0, 0xf10005e1, 0xf20005e2, - 0xf30005e3, 0xf40005e4, 0xf50005e5, 0xf60005e6, 0xf70005e7, 0xf80005e8, 0xf90005e9, 0xfa0005ea, - 0xd40005f0, 0xd50005f1, 0xd60005f2, 0xd70005f3, 0xd80005f4, 0xfd00200e, 0xfe00200f, 0x96002013, - 0x97002014, 0x91002018, 0x92002019, 0x8200201a, 0x9300201c, 0x9400201d, 0x8400201e, 0x86002020, - 0x87002021, 0x95002022, 0x85002026, 0x89002030, 0x8b002039, 0x9b00203a, 0xa40020aa, 0x800020ac, - 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, + 0xc60005b6, 0xc70005b7, 0xc80005b8, 0xc90005b9, 0xca0005ba, 0xcb0005bb, 0xcc0005bc, 0xcd0005bd, + 0xce0005be, 0xcf0005bf, 0xd00005c0, 0xd10005c1, 0xd20005c2, 0xd30005c3, 0xe00005d0, 0xe10005d1, + 0xe20005d2, 0xe30005d3, 0xe40005d4, 0xe50005d5, 0xe60005d6, 0xe70005d7, 0xe80005d8, 0xe90005d9, + 0xea0005da, 0xeb0005db, 0xec0005dc, 0xed0005dd, 0xee0005de, 0xef0005df, 0xf00005e0, 0xf10005e1, + 0xf20005e2, 0xf30005e3, 0xf40005e4, 0xf50005e5, 0xf60005e6, 0xf70005e7, 0xf80005e8, 0xf90005e9, + 0xfa0005ea, 0xd40005f0, 0xd50005f1, 0xd60005f2, 0xd70005f3, 0xd80005f4, 0xfd00200e, 0xfe00200f, + 0x96002013, 0x97002014, 0x91002018, 0x92002019, 0x8200201a, 0x9300201c, 0x9400201d, 0x8400201e, + 0x86002020, 0x87002021, 0x95002022, 0x85002026, 0x89002030, 0x8b002039, 0x9b00203a, 0xa40020aa, + 0x800020ac, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, 0x99002122, }, } // Windows1256 is the Windows 1256 encoding. -var Windows1256 encoding.Encoding = &windows1256 +var Windows1256 *Charmap = &windows1256 -var windows1256 = charmap{ +var windows1256 = Charmap{ name: "Windows 1256", mib: identifier.Windows1256, asciiSuperset: true, @@ -6833,9 +6833,9 @@ var windows1256 = charmap{ } // Windows1257 is the Windows 1257 encoding. -var Windows1257 encoding.Encoding = &windows1257 +var Windows1257 *Charmap = &windows1257 -var windows1257 = charmap{ +var windows1257 = Charmap{ name: "Windows 1257", mib: identifier.Windows1257, asciiSuperset: true, @@ -7008,9 +7008,9 @@ var windows1257 = charmap{ } // Windows1258 is the Windows 1258 encoding. -var Windows1258 encoding.Encoding = &windows1258 +var Windows1258 *Charmap = &windows1258 -var windows1258 = charmap{ +var windows1258 = Charmap{ name: "Windows 1258", mib: identifier.Windows1258, asciiSuperset: true, @@ -7185,9 +7185,9 @@ var windows1258 = charmap{ // XUserDefined is the X-User-Defined encoding. // // It is defined at http://encoding.spec.whatwg.org/#x-user-defined -var XUserDefined encoding.Encoding = &xUserDefined +var XUserDefined *Charmap = &xUserDefined -var xUserDefined = charmap{ +var xUserDefined = Charmap{ name: "X-User-Defined", mib: identifier.XUserDefined, asciiSuperset: true, diff --git a/vendor/golang.org/x/text/encoding/htmlindex/gen.go b/vendor/golang.org/x/text/encoding/htmlindex/gen.go index 80a52f0d..ac6b4a77 100644 --- a/vendor/golang.org/x/text/encoding/htmlindex/gen.go +++ b/vendor/golang.org/x/text/encoding/htmlindex/gen.go @@ -133,7 +133,10 @@ var consts = map[string]string{ // locales is taken from // https://html.spec.whatwg.org/multipage/syntax.html#encoding-sniffing-algorithm. var locales = []struct{ tag, name string }{ - {"und", "windows-1252"}, // The default value. + // The default value. Explicitly state latin to benefit from the exact + // script option, while still making 1252 the default encoding for languages + // written in Latin script. + {"und_Latn", "windows-1252"}, {"ar", "windows-1256"}, {"ba", "windows-1251"}, {"be", "windows-1251"}, diff --git a/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go b/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go index 70f2ac4b..bdc7d15d 100644 --- a/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go +++ b/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go @@ -50,7 +50,7 @@ func LanguageDefault(tag language.Tag) string { for _, t := range strings.Split(locales, " ") { tags = append(tags, language.MustParse(t)) } - matcher = language.NewMatcher(tags) + matcher = language.NewMatcher(tags, language.PreferSameScript(true)) }) _, i, _ := matcher.Match(tag) return canonical[localeMap[i]] // Default is Windows-1252. diff --git a/vendor/golang.org/x/text/encoding/htmlindex/tables.go b/vendor/golang.org/x/text/encoding/htmlindex/tables.go index 78950d3c..9d6b4315 100644 --- a/vendor/golang.org/x/text/encoding/htmlindex/tables.go +++ b/vendor/golang.org/x/text/encoding/htmlindex/tables.go @@ -1,4 +1,4 @@ -// This file was generated by go generate; DO NOT EDIT +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. package htmlindex @@ -313,7 +313,7 @@ var nameMap = map[string]htmlEncoding{ } var localeMap = []htmlEncoding{ - windows1252, // und + windows1252, // und_Latn windows1256, // ar windows1251, // ba windows1251, // be @@ -349,4 +349,4 @@ var localeMap = []htmlEncoding{ big5, // zh-hant } -const locales = "und ar ba be bg cs el et fa he hr hu ja kk ko ku ky lt lv mk pl ru sah sk sl sr tg th tr tt uk vi zh-hans zh-hant" +const locales = "und_Latn ar ba be bg cs el et fa he hr hu ja kk ko ku ky lt lv mk pl ru sah sk sl sr tg th tr tt uk vi zh-hans zh-hant" diff --git a/vendor/golang.org/x/text/encoding/ianaindex/gen.go b/vendor/golang.org/x/text/encoding/ianaindex/gen.go new file mode 100644 index 00000000..1b61b820 --- /dev/null +++ b/vendor/golang.org/x/text/encoding/ianaindex/gen.go @@ -0,0 +1,192 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ignore + +package main + +import ( + "encoding/xml" + "fmt" + "io" + "log" + "sort" + "strconv" + "strings" + + "golang.org/x/text/encoding/internal/identifier" + "golang.org/x/text/internal/gen" +) + +type registry struct { + XMLName xml.Name `xml:"registry"` + Updated string `xml:"updated"` + Registry []struct { + ID string `xml:"id,attr"` + Record []struct { + Name string `xml:"name"` + Xref []struct { + Type string `xml:"type,attr"` + Data string `xml:"data,attr"` + } `xml:"xref"` + Desc struct { + Data string `xml:",innerxml"` + } `xml:"description,"` + MIB string `xml:"value"` + Alias []string `xml:"alias"` + MIME string `xml:"preferred_alias"` + } `xml:"record"` + } `xml:"registry"` +} + +func main() { + r := gen.OpenIANAFile("assignments/character-sets/character-sets.xml") + reg := ®istry{} + if err := xml.NewDecoder(r).Decode(®); err != nil && err != io.EOF { + log.Fatalf("Error decoding charset registry: %v", err) + } + if len(reg.Registry) == 0 || reg.Registry[0].ID != "character-sets-1" { + log.Fatalf("Unexpected ID %s", reg.Registry[0].ID) + } + + x := &indexInfo{} + + for _, rec := range reg.Registry[0].Record { + mib := identifier.MIB(parseInt(rec.MIB)) + x.addEntry(mib, rec.Name) + for _, a := range rec.Alias { + a = strings.Split(a, " ")[0] // strip comments. + x.addAlias(a, mib) + // MIB name aliases are prefixed with a "cs" (character set) in the + // registry to identify them as display names and to ensure that + // the name starts with a lowercase letter in case it is used as + // an identifier. We remove it to be left with a nice clean name. + if strings.HasPrefix(a, "cs") { + x.setName(2, a[2:]) + } + } + if rec.MIME != "" { + x.addAlias(rec.MIME, mib) + x.setName(1, rec.MIME) + } + } + + w := gen.NewCodeWriter() + + fmt.Fprintln(w, `import "golang.org/x/text/encoding/internal/identifier"`) + + writeIndex(w, x) + + w.WriteGoFile("tables.go", "ianaindex") +} + +type alias struct { + name string + mib identifier.MIB +} + +type indexInfo struct { + // compacted index from code to MIB + codeToMIB []identifier.MIB + alias []alias + names [][3]string +} + +func (ii *indexInfo) Len() int { + return len(ii.codeToMIB) +} + +func (ii *indexInfo) Less(a, b int) bool { + return ii.codeToMIB[a] < ii.codeToMIB[b] +} + +func (ii *indexInfo) Swap(a, b int) { + ii.codeToMIB[a], ii.codeToMIB[b] = ii.codeToMIB[b], ii.codeToMIB[a] + // Co-sort the names. + ii.names[a], ii.names[b] = ii.names[b], ii.names[a] +} + +func (ii *indexInfo) setName(i int, name string) { + ii.names[len(ii.names)-1][i] = name +} + +func (ii *indexInfo) addEntry(mib identifier.MIB, name string) { + ii.names = append(ii.names, [3]string{name, name, name}) + ii.addAlias(name, mib) + ii.codeToMIB = append(ii.codeToMIB, mib) +} + +func (ii *indexInfo) addAlias(name string, mib identifier.MIB) { + // Don't add duplicates for the same mib. Adding duplicate aliases for + // different MIBs will cause the compiler to barf on an invalid map: great!. + for i := len(ii.alias) - 1; i >= 0 && ii.alias[i].mib == mib; i-- { + if ii.alias[i].name == name { + return + } + } + ii.alias = append(ii.alias, alias{name, mib}) + lower := strings.ToLower(name) + if lower != name { + ii.addAlias(lower, mib) + } +} + +const maxMIMENameLen = '0' - 1 // officially 40, but we leave some buffer. + +func writeIndex(w *gen.CodeWriter, x *indexInfo) { + sort.Stable(x) + + // Write constants. + fmt.Fprintln(w, "const (") + for i, m := range x.codeToMIB { + if i == 0 { + fmt.Fprintf(w, "enc%d = iota\n", m) + } else { + fmt.Fprintf(w, "enc%d\n", m) + } + } + fmt.Fprintln(w, "numIANA") + fmt.Fprintln(w, ")") + + w.WriteVar("ianaToMIB", x.codeToMIB) + + var ianaNames, mibNames []string + for _, names := range x.names { + n := names[0] + if names[0] != names[1] { + // MIME names are mostly identical to IANA names. We share the + // tables by setting the first byte of the string to an index into + // the string itself (< maxMIMENameLen) to the IANA name. The MIME + // name immediately follows the index. + x := len(names[1]) + 1 + if x > maxMIMENameLen { + log.Fatalf("MIME name length (%d) > %d", x, maxMIMENameLen) + } + n = string(x) + names[1] + names[0] + } + ianaNames = append(ianaNames, n) + mibNames = append(mibNames, names[2]) + } + + w.WriteVar("ianaNames", ianaNames) + w.WriteVar("mibNames", mibNames) + + w.WriteComment(` + TODO: Instead of using a map, we could use binary search strings doing + on-the fly lower-casing per character. This allows to always avoid + allocation and will be considerably more compact.`) + fmt.Fprintln(w, "var ianaAliases = map[string]int{") + for _, a := range x.alias { + fmt.Fprintf(w, "%q: enc%d,\n", a.name, a.mib) + } + fmt.Fprintln(w, "}") +} + +func parseInt(s string) int { + x, err := strconv.ParseInt(s, 10, 64) + if err != nil { + log.Fatalf("Could not parse integer: %v", err) + } + return int(x) +} diff --git a/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go b/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go index 344a8e6e..49b30704 100644 --- a/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go +++ b/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go @@ -2,17 +2,28 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:generate go run gen.go + // Package ianaindex maps names to Encodings as specified by the IANA registry. // This includes both the MIME and IANA names. // -// Status: this package is an incomplete API sketch, and isn't usable yet. -// // See http://www.iana.org/assignments/character-sets/character-sets.xhtml for // more details. package ianaindex import ( + "errors" + "sort" + "strings" + "golang.org/x/text/encoding" + "golang.org/x/text/encoding/charmap" + "golang.org/x/text/encoding/internal/identifier" + "golang.org/x/text/encoding/japanese" + "golang.org/x/text/encoding/korean" + "golang.org/x/text/encoding/simplifiedchinese" + "golang.org/x/text/encoding/traditionalchinese" + "golang.org/x/text/encoding/unicode" ) // TODO: remove the "Status... incomplete" in the package doc comment. @@ -25,28 +36,68 @@ import ( // support MIME otherwise. var ( - // MIME is an index to map MIME names. It does not support aliases. - MIME *Index + // MIME is an index to map MIME names. + MIME *Index = mime // IANA is an index that supports all names and aliases using IANA names as // the canonical identifier. - IANA *Index + IANA *Index = iana + + // MIB is an index that associates the MIB display name with an Encoding. + MIB *Index = mib + + mime = &Index{mimeName, ianaToMIB, ianaAliases, encodings[:]} + iana = &Index{ianaName, ianaToMIB, ianaAliases, encodings[:]} + mib = &Index{mibName, ianaToMIB, ianaAliases, encodings[:]} ) // Index maps names registered by IANA to Encodings. +// Currently different Indexes only differ in the names they return for +// encodings. In the future they may also differ in supported aliases. type Index struct { + names func(i int) string + toMIB []identifier.MIB // Sorted slice of supported MIBs + alias map[string]int + enc []encoding.Encoding } -// Get returns an Encoding for IANA-registered names. Matching is +var ( + errInvalidName = errors.New("ianaindex: invalid encoding name") + errUnknown = errors.New("ianaindex: unknown Encoding") + errUnsupported = errors.New("ianaindex: unsupported Encoding") +) + +// Encoding returns an Encoding for IANA-registered names. Matching is // case-insensitive. -func (x *Index) Get(name string) (encoding.Encoding, error) { - panic("TODO: implement") +func (x *Index) Encoding(name string) (encoding.Encoding, error) { + name = strings.TrimSpace(name) + // First try without lowercasing (possibly creating an allocation). + i, ok := x.alias[name] + if !ok { + i, ok = x.alias[strings.ToLower(name)] + if !ok { + return nil, errInvalidName + } + } + return x.enc[i], nil } // Name reports the canonical name of the given Encoding. It will return an // error if the e is not associated with a known encoding scheme. func (x *Index) Name(e encoding.Encoding) (string, error) { - panic("TODO: implement") + id, ok := e.(identifier.Interface) + if !ok { + return "", errUnknown + } + mib, _ := id.ID() + if mib == 0 { + return "", errUnknown + } + v := findMIB(x.toMIB, mib) + if v == -1 { + return "", errUnsupported + } + return x.names(v), nil } // TODO: the coverage of this index is rather spotty. Allowing users to set @@ -65,3 +116,94 @@ func (x *Index) Name(e encoding.Encoding) (string, error) { // func (x *Index) Set(name string, e encoding.Encoding) error { // panic("TODO: implement") // } + +func findMIB(x []identifier.MIB, mib identifier.MIB) int { + i := sort.Search(len(x), func(i int) bool { return x[i] >= mib }) + if i < len(x) && x[i] == mib { + return i + } + return -1 +} + +const maxMIMENameLen = '0' - 1 // officially 40, but we leave some buffer. + +func mimeName(x int) string { + n := ianaNames[x] + // See gen.go for a description of the encoding. + if n[0] <= maxMIMENameLen { + return n[1:n[0]] + } + return n +} + +func ianaName(x int) string { + n := ianaNames[x] + // See gen.go for a description of the encoding. + if n[0] <= maxMIMENameLen { + return n[n[0]:] + } + return n +} + +func mibName(x int) string { + return mibNames[x] +} + +var encodings = [numIANA]encoding.Encoding{ + enc106: unicode.UTF8, + enc1015: unicode.UTF16(unicode.BigEndian, unicode.UseBOM), + enc1013: unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM), + enc1014: unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM), + enc2028: charmap.CodePage037, + enc2011: charmap.CodePage437, + enc2009: charmap.CodePage850, + enc2010: charmap.CodePage852, + enc2046: charmap.CodePage855, + enc2089: charmap.CodePage858, + enc2048: charmap.CodePage860, + enc2013: charmap.CodePage862, + enc2050: charmap.CodePage863, + enc2052: charmap.CodePage865, + enc2086: charmap.CodePage866, + enc2102: charmap.CodePage1047, + enc2091: charmap.CodePage1140, + enc4: charmap.ISO8859_1, + enc5: charmap.ISO8859_2, + enc6: charmap.ISO8859_3, + enc7: charmap.ISO8859_4, + enc8: charmap.ISO8859_5, + enc9: charmap.ISO8859_6, + enc81: charmap.ISO8859_6E, + enc82: charmap.ISO8859_6I, + enc10: charmap.ISO8859_7, + enc11: charmap.ISO8859_8, + enc84: charmap.ISO8859_8E, + enc85: charmap.ISO8859_8I, + enc12: charmap.ISO8859_9, + enc13: charmap.ISO8859_10, + enc109: charmap.ISO8859_13, + enc110: charmap.ISO8859_14, + enc111: charmap.ISO8859_15, + enc112: charmap.ISO8859_16, + enc2084: charmap.KOI8R, + enc2088: charmap.KOI8U, + enc2027: charmap.Macintosh, + enc2109: charmap.Windows874, + enc2250: charmap.Windows1250, + enc2251: charmap.Windows1251, + enc2252: charmap.Windows1252, + enc2253: charmap.Windows1253, + enc2254: charmap.Windows1254, + enc2255: charmap.Windows1255, + enc2256: charmap.Windows1256, + enc2257: charmap.Windows1257, + enc2258: charmap.Windows1258, + enc18: japanese.EUCJP, + enc39: japanese.ISO2022JP, + enc17: japanese.ShiftJIS, + enc38: korean.EUCKR, + enc114: simplifiedchinese.GB18030, + enc113: simplifiedchinese.GBK, + enc2085: simplifiedchinese.HZGB2312, + enc2026: traditionalchinese.Big5, +} diff --git a/vendor/golang.org/x/text/encoding/ianaindex/tables.go b/vendor/golang.org/x/text/encoding/ianaindex/tables.go new file mode 100644 index 00000000..98a1d77c --- /dev/null +++ b/vendor/golang.org/x/text/encoding/ianaindex/tables.go @@ -0,0 +1,2348 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +package ianaindex + +import "golang.org/x/text/encoding/internal/identifier" + +const ( + enc3 = iota + enc4 + enc5 + enc6 + enc7 + enc8 + enc9 + enc10 + enc11 + enc12 + enc13 + enc14 + enc15 + enc16 + enc17 + enc18 + enc19 + enc20 + enc21 + enc22 + enc23 + enc24 + enc25 + enc26 + enc27 + enc28 + enc29 + enc30 + enc31 + enc32 + enc33 + enc34 + enc35 + enc36 + enc37 + enc38 + enc39 + enc40 + enc41 + enc42 + enc43 + enc44 + enc45 + enc46 + enc47 + enc48 + enc49 + enc50 + enc51 + enc52 + enc53 + enc54 + enc55 + enc56 + enc57 + enc58 + enc59 + enc60 + enc61 + enc62 + enc63 + enc64 + enc65 + enc66 + enc67 + enc68 + enc69 + enc70 + enc71 + enc72 + enc73 + enc74 + enc75 + enc76 + enc77 + enc78 + enc79 + enc80 + enc81 + enc82 + enc83 + enc84 + enc85 + enc86 + enc87 + enc88 + enc89 + enc90 + enc91 + enc92 + enc93 + enc94 + enc95 + enc96 + enc97 + enc98 + enc99 + enc100 + enc101 + enc102 + enc103 + enc104 + enc105 + enc106 + enc109 + enc110 + enc111 + enc112 + enc113 + enc114 + enc115 + enc116 + enc117 + enc118 + enc119 + enc1000 + enc1001 + enc1002 + enc1003 + enc1004 + enc1005 + enc1006 + enc1007 + enc1008 + enc1009 + enc1010 + enc1011 + enc1012 + enc1013 + enc1014 + enc1015 + enc1016 + enc1017 + enc1018 + enc1019 + enc1020 + enc2000 + enc2001 + enc2002 + enc2003 + enc2004 + enc2005 + enc2006 + enc2007 + enc2008 + enc2009 + enc2010 + enc2011 + enc2012 + enc2013 + enc2014 + enc2015 + enc2016 + enc2017 + enc2018 + enc2019 + enc2020 + enc2021 + enc2022 + enc2023 + enc2024 + enc2025 + enc2026 + enc2027 + enc2028 + enc2029 + enc2030 + enc2031 + enc2032 + enc2033 + enc2034 + enc2035 + enc2036 + enc2037 + enc2038 + enc2039 + enc2040 + enc2041 + enc2042 + enc2043 + enc2044 + enc2045 + enc2046 + enc2047 + enc2048 + enc2049 + enc2050 + enc2051 + enc2052 + enc2053 + enc2054 + enc2055 + enc2056 + enc2057 + enc2058 + enc2059 + enc2060 + enc2061 + enc2062 + enc2063 + enc2064 + enc2065 + enc2066 + enc2067 + enc2068 + enc2069 + enc2070 + enc2071 + enc2072 + enc2073 + enc2074 + enc2075 + enc2076 + enc2077 + enc2078 + enc2079 + enc2080 + enc2081 + enc2082 + enc2083 + enc2084 + enc2085 + enc2086 + enc2087 + enc2088 + enc2089 + enc2090 + enc2091 + enc2092 + enc2093 + enc2094 + enc2095 + enc2096 + enc2097 + enc2098 + enc2099 + enc2100 + enc2101 + enc2102 + enc2103 + enc2104 + enc2105 + enc2106 + enc2107 + enc2108 + enc2109 + enc2250 + enc2251 + enc2252 + enc2253 + enc2254 + enc2255 + enc2256 + enc2257 + enc2258 + enc2259 + enc2260 + numIANA +) + +var ianaToMIB = []identifier.MIB{ // 257 elements + // Entry 0 - 3F + 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, + 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, 0x0011, 0x0012, + 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, + 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, + 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, + 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, + 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, + 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x0041, 0x0042, + // Entry 40 - 7F + 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, + 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, + 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, + 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0060, 0x0061, 0x0062, + 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, + 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, + 0x0075, 0x0076, 0x0077, 0x03e8, 0x03e9, 0x03ea, 0x03eb, 0x03ec, + 0x03ed, 0x03ee, 0x03ef, 0x03f0, 0x03f1, 0x03f2, 0x03f3, 0x03f4, + // Entry 80 - BF + 0x03f5, 0x03f6, 0x03f7, 0x03f8, 0x03f9, 0x03fa, 0x03fb, 0x03fc, + 0x07d0, 0x07d1, 0x07d2, 0x07d3, 0x07d4, 0x07d5, 0x07d6, 0x07d7, + 0x07d8, 0x07d9, 0x07da, 0x07db, 0x07dc, 0x07dd, 0x07de, 0x07df, + 0x07e0, 0x07e1, 0x07e2, 0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, + 0x07e8, 0x07e9, 0x07ea, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, + 0x07f0, 0x07f1, 0x07f2, 0x07f3, 0x07f4, 0x07f5, 0x07f6, 0x07f7, + 0x07f8, 0x07f9, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x07fe, 0x07ff, + 0x0800, 0x0801, 0x0802, 0x0803, 0x0804, 0x0805, 0x0806, 0x0807, + // Entry C0 - FF + 0x0808, 0x0809, 0x080a, 0x080b, 0x080c, 0x080d, 0x080e, 0x080f, + 0x0810, 0x0811, 0x0812, 0x0813, 0x0814, 0x0815, 0x0816, 0x0817, + 0x0818, 0x0819, 0x081a, 0x081b, 0x081c, 0x081d, 0x081e, 0x081f, + 0x0820, 0x0821, 0x0822, 0x0823, 0x0824, 0x0825, 0x0826, 0x0827, + 0x0828, 0x0829, 0x082a, 0x082b, 0x082c, 0x082d, 0x082e, 0x082f, + 0x0830, 0x0831, 0x0832, 0x0833, 0x0834, 0x0835, 0x0836, 0x0837, + 0x0838, 0x0839, 0x083a, 0x083b, 0x083c, 0x083d, 0x08ca, 0x08cb, + 0x08cc, 0x08cd, 0x08ce, 0x08cf, 0x08d0, 0x08d1, 0x08d2, 0x08d3, + // Entry 100 - 13F + 0x08d4, +} // Size: 538 bytes + +var ianaNames = []string{ // 257 elements + "US-ASCII", + "\vISO-8859-1ISO_8859-1:1987", + "\vISO-8859-2ISO_8859-2:1987", + "\vISO-8859-3ISO_8859-3:1988", + "\vISO-8859-4ISO_8859-4:1988", + "\vISO-8859-5ISO_8859-5:1988", + "\vISO-8859-6ISO_8859-6:1987", + "\vISO-8859-7ISO_8859-7:1987", + "\vISO-8859-8ISO_8859-8:1988", + "\vISO-8859-9ISO_8859-9:1989", + "ISO-8859-10", + "ISO_6937-2-add", + "JIS_X0201", + "JIS_Encoding", + "Shift_JIS", + "\x07EUC-JPExtended_UNIX_Code_Packed_Format_for_Japanese", + "Extended_UNIX_Code_Fixed_Width_for_Japanese", + "BS_4730", + "SEN_850200_C", + "IT", + "ES", + "DIN_66003", + "NS_4551-1", + "NF_Z_62-010", + "ISO-10646-UTF-1", + "ISO_646.basic:1983", + "INVARIANT", + "ISO_646.irv:1983", + "NATS-SEFI", + "NATS-SEFI-ADD", + "NATS-DANO", + "NATS-DANO-ADD", + "SEN_850200_B", + "KS_C_5601-1987", + "ISO-2022-KR", + "EUC-KR", + "ISO-2022-JP", + "ISO-2022-JP-2", + "JIS_C6220-1969-jp", + "JIS_C6220-1969-ro", + "PT", + "greek7-old", + "latin-greek", + "NF_Z_62-010_(1973)", + "Latin-greek-1", + "ISO_5427", + "JIS_C6226-1978", + "BS_viewdata", + "INIS", + "INIS-8", + "INIS-cyrillic", + "ISO_5427:1981", + "ISO_5428:1980", + "GB_1988-80", + "GB_2312-80", + "NS_4551-2", + "videotex-suppl", + "PT2", + "ES2", + "MSZ_7795.3", + "JIS_C6226-1983", + "greek7", + "ASMO_449", + "iso-ir-90", + "JIS_C6229-1984-a", + "JIS_C6229-1984-b", + "JIS_C6229-1984-b-add", + "JIS_C6229-1984-hand", + "JIS_C6229-1984-hand-add", + "JIS_C6229-1984-kana", + "ISO_2033-1983", + "ANSI_X3.110-1983", + "T.61-7bit", + "T.61-8bit", + "ECMA-cyrillic", + "CSA_Z243.4-1985-1", + "CSA_Z243.4-1985-2", + "CSA_Z243.4-1985-gr", + "\rISO-8859-6-EISO_8859-6-E", + "\rISO-8859-6-IISO_8859-6-I", + "T.101-G2", + "\rISO-8859-8-EISO_8859-8-E", + "\rISO-8859-8-IISO_8859-8-I", + "CSN_369103", + "JUS_I.B1.002", + "IEC_P27-1", + "JUS_I.B1.003-serb", + "JUS_I.B1.003-mac", + "greek-ccitt", + "NC_NC00-10:81", + "ISO_6937-2-25", + "GOST_19768-74", + "ISO_8859-supp", + "ISO_10367-box", + "latin-lap", + "JIS_X0212-1990", + "DS_2089", + "us-dk", + "dk-us", + "KSC5636", + "UNICODE-1-1-UTF-7", + "ISO-2022-CN", + "ISO-2022-CN-EXT", + "UTF-8", + "ISO-8859-13", + "ISO-8859-14", + "ISO-8859-15", + "ISO-8859-16", + "GBK", + "GB18030", + "OSD_EBCDIC_DF04_15", + "OSD_EBCDIC_DF03_IRV", + "OSD_EBCDIC_DF04_1", + "ISO-11548-1", + "KZ-1048", + "ISO-10646-UCS-2", + "ISO-10646-UCS-4", + "ISO-10646-UCS-Basic", + "ISO-10646-Unicode-Latin1", + "ISO-10646-J-1", + "ISO-Unicode-IBM-1261", + "ISO-Unicode-IBM-1268", + "ISO-Unicode-IBM-1276", + "ISO-Unicode-IBM-1264", + "ISO-Unicode-IBM-1265", + "UNICODE-1-1", + "SCSU", + "UTF-7", + "UTF-16BE", + "UTF-16LE", + "UTF-16", + "CESU-8", + "UTF-32", + "UTF-32BE", + "UTF-32LE", + "BOCU-1", + "ISO-8859-1-Windows-3.0-Latin-1", + "ISO-8859-1-Windows-3.1-Latin-1", + "ISO-8859-2-Windows-Latin-2", + "ISO-8859-9-Windows-Latin-5", + "hp-roman8", + "Adobe-Standard-Encoding", + "Ventura-US", + "Ventura-International", + "DEC-MCS", + "IBM850", + "IBM852", + "IBM437", + "PC8-Danish-Norwegian", + "IBM862", + "PC8-Turkish", + "IBM-Symbols", + "IBM-Thai", + "HP-Legal", + "HP-Pi-font", + "HP-Math8", + "Adobe-Symbol-Encoding", + "HP-DeskTop", + "Ventura-Math", + "Microsoft-Publishing", + "Windows-31J", + "GB2312", + "Big5", + "macintosh", + "IBM037", + "IBM038", + "IBM273", + "IBM274", + "IBM275", + "IBM277", + "IBM278", + "IBM280", + "IBM281", + "IBM284", + "IBM285", + "IBM290", + "IBM297", + "IBM420", + "IBM423", + "IBM424", + "IBM500", + "IBM851", + "IBM855", + "IBM857", + "IBM860", + "IBM861", + "IBM863", + "IBM864", + "IBM865", + "IBM868", + "IBM869", + "IBM870", + "IBM871", + "IBM880", + "IBM891", + "IBM903", + "IBM904", + "IBM905", + "IBM918", + "IBM1026", + "EBCDIC-AT-DE", + "EBCDIC-AT-DE-A", + "EBCDIC-CA-FR", + "EBCDIC-DK-NO", + "EBCDIC-DK-NO-A", + "EBCDIC-FI-SE", + "EBCDIC-FI-SE-A", + "EBCDIC-FR", + "EBCDIC-IT", + "EBCDIC-PT", + "EBCDIC-ES", + "EBCDIC-ES-A", + "EBCDIC-ES-S", + "EBCDIC-UK", + "EBCDIC-US", + "UNKNOWN-8BIT", + "MNEMONIC", + "MNEM", + "VISCII", + "VIQR", + "KOI8-R", + "HZ-GB-2312", + "IBM866", + "IBM775", + "KOI8-U", + "IBM00858", + "IBM00924", + "IBM01140", + "IBM01141", + "IBM01142", + "IBM01143", + "IBM01144", + "IBM01145", + "IBM01146", + "IBM01147", + "IBM01148", + "IBM01149", + "Big5-HKSCS", + "IBM1047", + "PTCP154", + "Amiga-1251", + "KOI7-switched", + "BRF", + "TSCII", + "CP51932", + "windows-874", + "windows-1250", + "windows-1251", + "windows-1252", + "windows-1253", + "windows-1254", + "windows-1255", + "windows-1256", + "windows-1257", + "windows-1258", + "TIS-620", + "CP50220", +} // Size: 7088 bytes + +var mibNames = []string{ // 257 elements + "ASCII", + "ISOLatin1", + "ISOLatin2", + "ISOLatin3", + "ISOLatin4", + "ISOLatinCyrillic", + "ISOLatinArabic", + "ISOLatinGreek", + "ISOLatinHebrew", + "ISOLatin5", + "ISOLatin6", + "ISOTextComm", + "HalfWidthKatakana", + "JISEncoding", + "ShiftJIS", + "EUCPkdFmtJapanese", + "EUCFixWidJapanese", + "ISO4UnitedKingdom", + "ISO11SwedishForNames", + "ISO15Italian", + "ISO17Spanish", + "ISO21German", + "ISO60Norwegian1", + "ISO69French", + "ISO10646UTF1", + "ISO646basic1983", + "INVARIANT", + "ISO2IntlRefVersion", + "NATSSEFI", + "NATSSEFIADD", + "NATSDANO", + "NATSDANOADD", + "ISO10Swedish", + "KSC56011987", + "ISO2022KR", + "EUCKR", + "ISO2022JP", + "ISO2022JP2", + "ISO13JISC6220jp", + "ISO14JISC6220ro", + "ISO16Portuguese", + "ISO18Greek7Old", + "ISO19LatinGreek", + "ISO25French", + "ISO27LatinGreek1", + "ISO5427Cyrillic", + "ISO42JISC62261978", + "ISO47BSViewdata", + "ISO49INIS", + "ISO50INIS8", + "ISO51INISCyrillic", + "ISO54271981", + "ISO5428Greek", + "ISO57GB1988", + "ISO58GB231280", + "ISO61Norwegian2", + "ISO70VideotexSupp1", + "ISO84Portuguese2", + "ISO85Spanish2", + "ISO86Hungarian", + "ISO87JISX0208", + "ISO88Greek7", + "ISO89ASMO449", + "ISO90", + "ISO91JISC62291984a", + "ISO92JISC62991984b", + "ISO93JIS62291984badd", + "ISO94JIS62291984hand", + "ISO95JIS62291984handadd", + "ISO96JISC62291984kana", + "ISO2033", + "ISO99NAPLPS", + "ISO102T617bit", + "ISO103T618bit", + "ISO111ECMACyrillic", + "ISO121Canadian1", + "ISO122Canadian2", + "ISO123CSAZ24341985gr", + "ISO88596E", + "ISO88596I", + "ISO128T101G2", + "ISO88598E", + "ISO88598I", + "ISO139CSN369103", + "ISO141JUSIB1002", + "ISO143IECP271", + "ISO146Serbian", + "ISO147Macedonian", + "ISO150GreekCCITT", + "ISO151Cuba", + "ISO6937Add", + "ISO153GOST1976874", + "ISO8859Supp", + "ISO10367Box", + "ISO158Lap", + "ISO159JISX02121990", + "ISO646Danish", + "USDK", + "DKUS", + "KSC5636", + "Unicode11UTF7", + "ISO2022CN", + "ISO2022CNEXT", + "UTF8", + "ISO885913", + "ISO885914", + "ISO885915", + "ISO885916", + "GBK", + "GB18030", + "OSDEBCDICDF0415", + "OSDEBCDICDF03IRV", + "OSDEBCDICDF041", + "ISO115481", + "KZ1048", + "Unicode", + "UCS4", + "UnicodeASCII", + "UnicodeLatin1", + "UnicodeJapanese", + "UnicodeIBM1261", + "UnicodeIBM1268", + "UnicodeIBM1276", + "UnicodeIBM1264", + "UnicodeIBM1265", + "Unicode11", + "SCSU", + "UTF7", + "UTF16BE", + "UTF16LE", + "UTF16", + "CESU-8", + "UTF32", + "UTF32BE", + "UTF32LE", + "BOCU-1", + "Windows30Latin1", + "Windows31Latin1", + "Windows31Latin2", + "Windows31Latin5", + "HPRoman8", + "AdobeStandardEncoding", + "VenturaUS", + "VenturaInternational", + "DECMCS", + "PC850Multilingual", + "PCp852", + "PC8CodePage437", + "PC8DanishNorwegian", + "PC862LatinHebrew", + "PC8Turkish", + "IBMSymbols", + "IBMThai", + "HPLegal", + "HPPiFont", + "HPMath8", + "HPPSMath", + "HPDesktop", + "VenturaMath", + "MicrosoftPublishing", + "Windows31J", + "GB2312", + "Big5", + "Macintosh", + "IBM037", + "IBM038", + "IBM273", + "IBM274", + "IBM275", + "IBM277", + "IBM278", + "IBM280", + "IBM281", + "IBM284", + "IBM285", + "IBM290", + "IBM297", + "IBM420", + "IBM423", + "IBM424", + "IBM500", + "IBM851", + "IBM855", + "IBM857", + "IBM860", + "IBM861", + "IBM863", + "IBM864", + "IBM865", + "IBM868", + "IBM869", + "IBM870", + "IBM871", + "IBM880", + "IBM891", + "IBM903", + "IBBM904", + "IBM905", + "IBM918", + "IBM1026", + "IBMEBCDICATDE", + "EBCDICATDEA", + "EBCDICCAFR", + "EBCDICDKNO", + "EBCDICDKNOA", + "EBCDICFISE", + "EBCDICFISEA", + "EBCDICFR", + "EBCDICIT", + "EBCDICPT", + "EBCDICES", + "EBCDICESA", + "EBCDICESS", + "EBCDICUK", + "EBCDICUS", + "Unknown8BiT", + "Mnemonic", + "Mnem", + "VISCII", + "VIQR", + "KOI8R", + "HZ-GB-2312", + "IBM866", + "PC775Baltic", + "KOI8U", + "IBM00858", + "IBM00924", + "IBM01140", + "IBM01141", + "IBM01142", + "IBM01143", + "IBM01144", + "IBM01145", + "IBM01146", + "IBM01147", + "IBM01148", + "IBM01149", + "Big5HKSCS", + "IBM1047", + "PTCP154", + "Amiga1251\n(Aliases", + "KOI7switched", + "BRF", + "TSCII", + "CP51932", + "windows874", + "windows1250", + "windows1251", + "windows1252", + "windows1253", + "windows1254", + "windows1255", + "windows1256", + "windows1257", + "windows1258", + "TIS620", + "CP50220", +} // Size: 6776 bytes + +// TODO: Instead of using a map, we could use binary search strings doing +// on-the fly lower-casing per character. This allows to always avoid +// allocation and will be considerably more compact. +var ianaAliases = map[string]int{ + "US-ASCII": enc3, + "us-ascii": enc3, + "iso-ir-6": enc3, + "ANSI_X3.4-1968": enc3, + "ansi_x3.4-1968": enc3, + "ANSI_X3.4-1986": enc3, + "ansi_x3.4-1986": enc3, + "ISO_646.irv:1991": enc3, + "iso_646.irv:1991": enc3, + "ISO646-US": enc3, + "iso646-us": enc3, + "us": enc3, + "IBM367": enc3, + "ibm367": enc3, + "cp367": enc3, + "csASCII": enc3, + "csascii": enc3, + "ISO_8859-1:1987": enc4, + "iso_8859-1:1987": enc4, + "iso-ir-100": enc4, + "ISO_8859-1": enc4, + "iso_8859-1": enc4, + "ISO-8859-1": enc4, + "iso-8859-1": enc4, + "latin1": enc4, + "l1": enc4, + "IBM819": enc4, + "ibm819": enc4, + "CP819": enc4, + "cp819": enc4, + "csISOLatin1": enc4, + "csisolatin1": enc4, + "ISO_8859-2:1987": enc5, + "iso_8859-2:1987": enc5, + "iso-ir-101": enc5, + "ISO_8859-2": enc5, + "iso_8859-2": enc5, + "ISO-8859-2": enc5, + "iso-8859-2": enc5, + "latin2": enc5, + "l2": enc5, + "csISOLatin2": enc5, + "csisolatin2": enc5, + "ISO_8859-3:1988": enc6, + "iso_8859-3:1988": enc6, + "iso-ir-109": enc6, + "ISO_8859-3": enc6, + "iso_8859-3": enc6, + "ISO-8859-3": enc6, + "iso-8859-3": enc6, + "latin3": enc6, + "l3": enc6, + "csISOLatin3": enc6, + "csisolatin3": enc6, + "ISO_8859-4:1988": enc7, + "iso_8859-4:1988": enc7, + "iso-ir-110": enc7, + "ISO_8859-4": enc7, + "iso_8859-4": enc7, + "ISO-8859-4": enc7, + "iso-8859-4": enc7, + "latin4": enc7, + "l4": enc7, + "csISOLatin4": enc7, + "csisolatin4": enc7, + "ISO_8859-5:1988": enc8, + "iso_8859-5:1988": enc8, + "iso-ir-144": enc8, + "ISO_8859-5": enc8, + "iso_8859-5": enc8, + "ISO-8859-5": enc8, + "iso-8859-5": enc8, + "cyrillic": enc8, + "csISOLatinCyrillic": enc8, + "csisolatincyrillic": enc8, + "ISO_8859-6:1987": enc9, + "iso_8859-6:1987": enc9, + "iso-ir-127": enc9, + "ISO_8859-6": enc9, + "iso_8859-6": enc9, + "ISO-8859-6": enc9, + "iso-8859-6": enc9, + "ECMA-114": enc9, + "ecma-114": enc9, + "ASMO-708": enc9, + "asmo-708": enc9, + "arabic": enc9, + "csISOLatinArabic": enc9, + "csisolatinarabic": enc9, + "ISO_8859-7:1987": enc10, + "iso_8859-7:1987": enc10, + "iso-ir-126": enc10, + "ISO_8859-7": enc10, + "iso_8859-7": enc10, + "ISO-8859-7": enc10, + "iso-8859-7": enc10, + "ELOT_928": enc10, + "elot_928": enc10, + "ECMA-118": enc10, + "ecma-118": enc10, + "greek": enc10, + "greek8": enc10, + "csISOLatinGreek": enc10, + "csisolatingreek": enc10, + "ISO_8859-8:1988": enc11, + "iso_8859-8:1988": enc11, + "iso-ir-138": enc11, + "ISO_8859-8": enc11, + "iso_8859-8": enc11, + "ISO-8859-8": enc11, + "iso-8859-8": enc11, + "hebrew": enc11, + "csISOLatinHebrew": enc11, + "csisolatinhebrew": enc11, + "ISO_8859-9:1989": enc12, + "iso_8859-9:1989": enc12, + "iso-ir-148": enc12, + "ISO_8859-9": enc12, + "iso_8859-9": enc12, + "ISO-8859-9": enc12, + "iso-8859-9": enc12, + "latin5": enc12, + "l5": enc12, + "csISOLatin5": enc12, + "csisolatin5": enc12, + "ISO-8859-10": enc13, + "iso-8859-10": enc13, + "iso-ir-157": enc13, + "l6": enc13, + "ISO_8859-10:1992": enc13, + "iso_8859-10:1992": enc13, + "csISOLatin6": enc13, + "csisolatin6": enc13, + "latin6": enc13, + "ISO_6937-2-add": enc14, + "iso_6937-2-add": enc14, + "iso-ir-142": enc14, + "csISOTextComm": enc14, + "csisotextcomm": enc14, + "JIS_X0201": enc15, + "jis_x0201": enc15, + "X0201": enc15, + "x0201": enc15, + "csHalfWidthKatakana": enc15, + "cshalfwidthkatakana": enc15, + "JIS_Encoding": enc16, + "jis_encoding": enc16, + "csJISEncoding": enc16, + "csjisencoding": enc16, + "Shift_JIS": enc17, + "shift_jis": enc17, + "MS_Kanji": enc17, + "ms_kanji": enc17, + "csShiftJIS": enc17, + "csshiftjis": enc17, + "Extended_UNIX_Code_Packed_Format_for_Japanese": enc18, + "extended_unix_code_packed_format_for_japanese": enc18, + "csEUCPkdFmtJapanese": enc18, + "cseucpkdfmtjapanese": enc18, + "EUC-JP": enc18, + "euc-jp": enc18, + "Extended_UNIX_Code_Fixed_Width_for_Japanese": enc19, + "extended_unix_code_fixed_width_for_japanese": enc19, + "csEUCFixWidJapanese": enc19, + "cseucfixwidjapanese": enc19, + "BS_4730": enc20, + "bs_4730": enc20, + "iso-ir-4": enc20, + "ISO646-GB": enc20, + "iso646-gb": enc20, + "gb": enc20, + "uk": enc20, + "csISO4UnitedKingdom": enc20, + "csiso4unitedkingdom": enc20, + "SEN_850200_C": enc21, + "sen_850200_c": enc21, + "iso-ir-11": enc21, + "ISO646-SE2": enc21, + "iso646-se2": enc21, + "se2": enc21, + "csISO11SwedishForNames": enc21, + "csiso11swedishfornames": enc21, + "IT": enc22, + "it": enc22, + "iso-ir-15": enc22, + "ISO646-IT": enc22, + "iso646-it": enc22, + "csISO15Italian": enc22, + "csiso15italian": enc22, + "ES": enc23, + "es": enc23, + "iso-ir-17": enc23, + "ISO646-ES": enc23, + "iso646-es": enc23, + "csISO17Spanish": enc23, + "csiso17spanish": enc23, + "DIN_66003": enc24, + "din_66003": enc24, + "iso-ir-21": enc24, + "de": enc24, + "ISO646-DE": enc24, + "iso646-de": enc24, + "csISO21German": enc24, + "csiso21german": enc24, + "NS_4551-1": enc25, + "ns_4551-1": enc25, + "iso-ir-60": enc25, + "ISO646-NO": enc25, + "iso646-no": enc25, + "no": enc25, + "csISO60DanishNorwegian": enc25, + "csiso60danishnorwegian": enc25, + "csISO60Norwegian1": enc25, + "csiso60norwegian1": enc25, + "NF_Z_62-010": enc26, + "nf_z_62-010": enc26, + "iso-ir-69": enc26, + "ISO646-FR": enc26, + "iso646-fr": enc26, + "fr": enc26, + "csISO69French": enc26, + "csiso69french": enc26, + "ISO-10646-UTF-1": enc27, + "iso-10646-utf-1": enc27, + "csISO10646UTF1": enc27, + "csiso10646utf1": enc27, + "ISO_646.basic:1983": enc28, + "iso_646.basic:1983": enc28, + "ref": enc28, + "csISO646basic1983": enc28, + "csiso646basic1983": enc28, + "INVARIANT": enc29, + "invariant": enc29, + "csINVARIANT": enc29, + "csinvariant": enc29, + "ISO_646.irv:1983": enc30, + "iso_646.irv:1983": enc30, + "iso-ir-2": enc30, + "irv": enc30, + "csISO2IntlRefVersion": enc30, + "csiso2intlrefversion": enc30, + "NATS-SEFI": enc31, + "nats-sefi": enc31, + "iso-ir-8-1": enc31, + "csNATSSEFI": enc31, + "csnatssefi": enc31, + "NATS-SEFI-ADD": enc32, + "nats-sefi-add": enc32, + "iso-ir-8-2": enc32, + "csNATSSEFIADD": enc32, + "csnatssefiadd": enc32, + "NATS-DANO": enc33, + "nats-dano": enc33, + "iso-ir-9-1": enc33, + "csNATSDANO": enc33, + "csnatsdano": enc33, + "NATS-DANO-ADD": enc34, + "nats-dano-add": enc34, + "iso-ir-9-2": enc34, + "csNATSDANOADD": enc34, + "csnatsdanoadd": enc34, + "SEN_850200_B": enc35, + "sen_850200_b": enc35, + "iso-ir-10": enc35, + "FI": enc35, + "fi": enc35, + "ISO646-FI": enc35, + "iso646-fi": enc35, + "ISO646-SE": enc35, + "iso646-se": enc35, + "se": enc35, + "csISO10Swedish": enc35, + "csiso10swedish": enc35, + "KS_C_5601-1987": enc36, + "ks_c_5601-1987": enc36, + "iso-ir-149": enc36, + "KS_C_5601-1989": enc36, + "ks_c_5601-1989": enc36, + "KSC_5601": enc36, + "ksc_5601": enc36, + "korean": enc36, + "csKSC56011987": enc36, + "csksc56011987": enc36, + "ISO-2022-KR": enc37, + "iso-2022-kr": enc37, + "csISO2022KR": enc37, + "csiso2022kr": enc37, + "EUC-KR": enc38, + "euc-kr": enc38, + "csEUCKR": enc38, + "cseuckr": enc38, + "ISO-2022-JP": enc39, + "iso-2022-jp": enc39, + "csISO2022JP": enc39, + "csiso2022jp": enc39, + "ISO-2022-JP-2": enc40, + "iso-2022-jp-2": enc40, + "csISO2022JP2": enc40, + "csiso2022jp2": enc40, + "JIS_C6220-1969-jp": enc41, + "jis_c6220-1969-jp": enc41, + "JIS_C6220-1969": enc41, + "jis_c6220-1969": enc41, + "iso-ir-13": enc41, + "katakana": enc41, + "x0201-7": enc41, + "csISO13JISC6220jp": enc41, + "csiso13jisc6220jp": enc41, + "JIS_C6220-1969-ro": enc42, + "jis_c6220-1969-ro": enc42, + "iso-ir-14": enc42, + "jp": enc42, + "ISO646-JP": enc42, + "iso646-jp": enc42, + "csISO14JISC6220ro": enc42, + "csiso14jisc6220ro": enc42, + "PT": enc43, + "pt": enc43, + "iso-ir-16": enc43, + "ISO646-PT": enc43, + "iso646-pt": enc43, + "csISO16Portuguese": enc43, + "csiso16portuguese": enc43, + "greek7-old": enc44, + "iso-ir-18": enc44, + "csISO18Greek7Old": enc44, + "csiso18greek7old": enc44, + "latin-greek": enc45, + "iso-ir-19": enc45, + "csISO19LatinGreek": enc45, + "csiso19latingreek": enc45, + "NF_Z_62-010_(1973)": enc46, + "nf_z_62-010_(1973)": enc46, + "iso-ir-25": enc46, + "ISO646-FR1": enc46, + "iso646-fr1": enc46, + "csISO25French": enc46, + "csiso25french": enc46, + "Latin-greek-1": enc47, + "latin-greek-1": enc47, + "iso-ir-27": enc47, + "csISO27LatinGreek1": enc47, + "csiso27latingreek1": enc47, + "ISO_5427": enc48, + "iso_5427": enc48, + "iso-ir-37": enc48, + "csISO5427Cyrillic": enc48, + "csiso5427cyrillic": enc48, + "JIS_C6226-1978": enc49, + "jis_c6226-1978": enc49, + "iso-ir-42": enc49, + "csISO42JISC62261978": enc49, + "csiso42jisc62261978": enc49, + "BS_viewdata": enc50, + "bs_viewdata": enc50, + "iso-ir-47": enc50, + "csISO47BSViewdata": enc50, + "csiso47bsviewdata": enc50, + "INIS": enc51, + "inis": enc51, + "iso-ir-49": enc51, + "csISO49INIS": enc51, + "csiso49inis": enc51, + "INIS-8": enc52, + "inis-8": enc52, + "iso-ir-50": enc52, + "csISO50INIS8": enc52, + "csiso50inis8": enc52, + "INIS-cyrillic": enc53, + "inis-cyrillic": enc53, + "iso-ir-51": enc53, + "csISO51INISCyrillic": enc53, + "csiso51iniscyrillic": enc53, + "ISO_5427:1981": enc54, + "iso_5427:1981": enc54, + "iso-ir-54": enc54, + "ISO5427Cyrillic1981": enc54, + "iso5427cyrillic1981": enc54, + "csISO54271981": enc54, + "csiso54271981": enc54, + "ISO_5428:1980": enc55, + "iso_5428:1980": enc55, + "iso-ir-55": enc55, + "csISO5428Greek": enc55, + "csiso5428greek": enc55, + "GB_1988-80": enc56, + "gb_1988-80": enc56, + "iso-ir-57": enc56, + "cn": enc56, + "ISO646-CN": enc56, + "iso646-cn": enc56, + "csISO57GB1988": enc56, + "csiso57gb1988": enc56, + "GB_2312-80": enc57, + "gb_2312-80": enc57, + "iso-ir-58": enc57, + "chinese": enc57, + "csISO58GB231280": enc57, + "csiso58gb231280": enc57, + "NS_4551-2": enc58, + "ns_4551-2": enc58, + "ISO646-NO2": enc58, + "iso646-no2": enc58, + "iso-ir-61": enc58, + "no2": enc58, + "csISO61Norwegian2": enc58, + "csiso61norwegian2": enc58, + "videotex-suppl": enc59, + "iso-ir-70": enc59, + "csISO70VideotexSupp1": enc59, + "csiso70videotexsupp1": enc59, + "PT2": enc60, + "pt2": enc60, + "iso-ir-84": enc60, + "ISO646-PT2": enc60, + "iso646-pt2": enc60, + "csISO84Portuguese2": enc60, + "csiso84portuguese2": enc60, + "ES2": enc61, + "es2": enc61, + "iso-ir-85": enc61, + "ISO646-ES2": enc61, + "iso646-es2": enc61, + "csISO85Spanish2": enc61, + "csiso85spanish2": enc61, + "MSZ_7795.3": enc62, + "msz_7795.3": enc62, + "iso-ir-86": enc62, + "ISO646-HU": enc62, + "iso646-hu": enc62, + "hu": enc62, + "csISO86Hungarian": enc62, + "csiso86hungarian": enc62, + "JIS_C6226-1983": enc63, + "jis_c6226-1983": enc63, + "iso-ir-87": enc63, + "x0208": enc63, + "JIS_X0208-1983": enc63, + "jis_x0208-1983": enc63, + "csISO87JISX0208": enc63, + "csiso87jisx0208": enc63, + "greek7": enc64, + "iso-ir-88": enc64, + "csISO88Greek7": enc64, + "csiso88greek7": enc64, + "ASMO_449": enc65, + "asmo_449": enc65, + "ISO_9036": enc65, + "iso_9036": enc65, + "arabic7": enc65, + "iso-ir-89": enc65, + "csISO89ASMO449": enc65, + "csiso89asmo449": enc65, + "iso-ir-90": enc66, + "csISO90": enc66, + "csiso90": enc66, + "JIS_C6229-1984-a": enc67, + "jis_c6229-1984-a": enc67, + "iso-ir-91": enc67, + "jp-ocr-a": enc67, + "csISO91JISC62291984a": enc67, + "csiso91jisc62291984a": enc67, + "JIS_C6229-1984-b": enc68, + "jis_c6229-1984-b": enc68, + "iso-ir-92": enc68, + "ISO646-JP-OCR-B": enc68, + "iso646-jp-ocr-b": enc68, + "jp-ocr-b": enc68, + "csISO92JISC62991984b": enc68, + "csiso92jisc62991984b": enc68, + "JIS_C6229-1984-b-add": enc69, + "jis_c6229-1984-b-add": enc69, + "iso-ir-93": enc69, + "jp-ocr-b-add": enc69, + "csISO93JIS62291984badd": enc69, + "csiso93jis62291984badd": enc69, + "JIS_C6229-1984-hand": enc70, + "jis_c6229-1984-hand": enc70, + "iso-ir-94": enc70, + "jp-ocr-hand": enc70, + "csISO94JIS62291984hand": enc70, + "csiso94jis62291984hand": enc70, + "JIS_C6229-1984-hand-add": enc71, + "jis_c6229-1984-hand-add": enc71, + "iso-ir-95": enc71, + "jp-ocr-hand-add": enc71, + "csISO95JIS62291984handadd": enc71, + "csiso95jis62291984handadd": enc71, + "JIS_C6229-1984-kana": enc72, + "jis_c6229-1984-kana": enc72, + "iso-ir-96": enc72, + "csISO96JISC62291984kana": enc72, + "csiso96jisc62291984kana": enc72, + "ISO_2033-1983": enc73, + "iso_2033-1983": enc73, + "iso-ir-98": enc73, + "e13b": enc73, + "csISO2033": enc73, + "csiso2033": enc73, + "ANSI_X3.110-1983": enc74, + "ansi_x3.110-1983": enc74, + "iso-ir-99": enc74, + "CSA_T500-1983": enc74, + "csa_t500-1983": enc74, + "NAPLPS": enc74, + "naplps": enc74, + "csISO99NAPLPS": enc74, + "csiso99naplps": enc74, + "T.61-7bit": enc75, + "t.61-7bit": enc75, + "iso-ir-102": enc75, + "csISO102T617bit": enc75, + "csiso102t617bit": enc75, + "T.61-8bit": enc76, + "t.61-8bit": enc76, + "T.61": enc76, + "t.61": enc76, + "iso-ir-103": enc76, + "csISO103T618bit": enc76, + "csiso103t618bit": enc76, + "ECMA-cyrillic": enc77, + "ecma-cyrillic": enc77, + "iso-ir-111": enc77, + "KOI8-E": enc77, + "koi8-e": enc77, + "csISO111ECMACyrillic": enc77, + "csiso111ecmacyrillic": enc77, + "CSA_Z243.4-1985-1": enc78, + "csa_z243.4-1985-1": enc78, + "iso-ir-121": enc78, + "ISO646-CA": enc78, + "iso646-ca": enc78, + "csa7-1": enc78, + "csa71": enc78, + "ca": enc78, + "csISO121Canadian1": enc78, + "csiso121canadian1": enc78, + "CSA_Z243.4-1985-2": enc79, + "csa_z243.4-1985-2": enc79, + "iso-ir-122": enc79, + "ISO646-CA2": enc79, + "iso646-ca2": enc79, + "csa7-2": enc79, + "csa72": enc79, + "csISO122Canadian2": enc79, + "csiso122canadian2": enc79, + "CSA_Z243.4-1985-gr": enc80, + "csa_z243.4-1985-gr": enc80, + "iso-ir-123": enc80, + "csISO123CSAZ24341985gr": enc80, + "csiso123csaz24341985gr": enc80, + "ISO_8859-6-E": enc81, + "iso_8859-6-e": enc81, + "csISO88596E": enc81, + "csiso88596e": enc81, + "ISO-8859-6-E": enc81, + "iso-8859-6-e": enc81, + "ISO_8859-6-I": enc82, + "iso_8859-6-i": enc82, + "csISO88596I": enc82, + "csiso88596i": enc82, + "ISO-8859-6-I": enc82, + "iso-8859-6-i": enc82, + "T.101-G2": enc83, + "t.101-g2": enc83, + "iso-ir-128": enc83, + "csISO128T101G2": enc83, + "csiso128t101g2": enc83, + "ISO_8859-8-E": enc84, + "iso_8859-8-e": enc84, + "csISO88598E": enc84, + "csiso88598e": enc84, + "ISO-8859-8-E": enc84, + "iso-8859-8-e": enc84, + "ISO_8859-8-I": enc85, + "iso_8859-8-i": enc85, + "csISO88598I": enc85, + "csiso88598i": enc85, + "ISO-8859-8-I": enc85, + "iso-8859-8-i": enc85, + "CSN_369103": enc86, + "csn_369103": enc86, + "iso-ir-139": enc86, + "csISO139CSN369103": enc86, + "csiso139csn369103": enc86, + "JUS_I.B1.002": enc87, + "jus_i.b1.002": enc87, + "iso-ir-141": enc87, + "ISO646-YU": enc87, + "iso646-yu": enc87, + "js": enc87, + "yu": enc87, + "csISO141JUSIB1002": enc87, + "csiso141jusib1002": enc87, + "IEC_P27-1": enc88, + "iec_p27-1": enc88, + "iso-ir-143": enc88, + "csISO143IECP271": enc88, + "csiso143iecp271": enc88, + "JUS_I.B1.003-serb": enc89, + "jus_i.b1.003-serb": enc89, + "iso-ir-146": enc89, + "serbian": enc89, + "csISO146Serbian": enc89, + "csiso146serbian": enc89, + "JUS_I.B1.003-mac": enc90, + "jus_i.b1.003-mac": enc90, + "macedonian": enc90, + "iso-ir-147": enc90, + "csISO147Macedonian": enc90, + "csiso147macedonian": enc90, + "greek-ccitt": enc91, + "iso-ir-150": enc91, + "csISO150": enc91, + "csiso150": enc91, + "csISO150GreekCCITT": enc91, + "csiso150greekccitt": enc91, + "NC_NC00-10:81": enc92, + "nc_nc00-10:81": enc92, + "cuba": enc92, + "iso-ir-151": enc92, + "ISO646-CU": enc92, + "iso646-cu": enc92, + "csISO151Cuba": enc92, + "csiso151cuba": enc92, + "ISO_6937-2-25": enc93, + "iso_6937-2-25": enc93, + "iso-ir-152": enc93, + "csISO6937Add": enc93, + "csiso6937add": enc93, + "GOST_19768-74": enc94, + "gost_19768-74": enc94, + "ST_SEV_358-88": enc94, + "st_sev_358-88": enc94, + "iso-ir-153": enc94, + "csISO153GOST1976874": enc94, + "csiso153gost1976874": enc94, + "ISO_8859-supp": enc95, + "iso_8859-supp": enc95, + "iso-ir-154": enc95, + "latin1-2-5": enc95, + "csISO8859Supp": enc95, + "csiso8859supp": enc95, + "ISO_10367-box": enc96, + "iso_10367-box": enc96, + "iso-ir-155": enc96, + "csISO10367Box": enc96, + "csiso10367box": enc96, + "latin-lap": enc97, + "lap": enc97, + "iso-ir-158": enc97, + "csISO158Lap": enc97, + "csiso158lap": enc97, + "JIS_X0212-1990": enc98, + "jis_x0212-1990": enc98, + "x0212": enc98, + "iso-ir-159": enc98, + "csISO159JISX02121990": enc98, + "csiso159jisx02121990": enc98, + "DS_2089": enc99, + "ds_2089": enc99, + "DS2089": enc99, + "ds2089": enc99, + "ISO646-DK": enc99, + "iso646-dk": enc99, + "dk": enc99, + "csISO646Danish": enc99, + "csiso646danish": enc99, + "us-dk": enc100, + "csUSDK": enc100, + "csusdk": enc100, + "dk-us": enc101, + "csDKUS": enc101, + "csdkus": enc101, + "KSC5636": enc102, + "ksc5636": enc102, + "ISO646-KR": enc102, + "iso646-kr": enc102, + "csKSC5636": enc102, + "csksc5636": enc102, + "UNICODE-1-1-UTF-7": enc103, + "unicode-1-1-utf-7": enc103, + "csUnicode11UTF7": enc103, + "csunicode11utf7": enc103, + "ISO-2022-CN": enc104, + "iso-2022-cn": enc104, + "csISO2022CN": enc104, + "csiso2022cn": enc104, + "ISO-2022-CN-EXT": enc105, + "iso-2022-cn-ext": enc105, + "csISO2022CNEXT": enc105, + "csiso2022cnext": enc105, + "UTF-8": enc106, + "utf-8": enc106, + "csUTF8": enc106, + "csutf8": enc106, + "ISO-8859-13": enc109, + "iso-8859-13": enc109, + "csISO885913": enc109, + "csiso885913": enc109, + "ISO-8859-14": enc110, + "iso-8859-14": enc110, + "iso-ir-199": enc110, + "ISO_8859-14:1998": enc110, + "iso_8859-14:1998": enc110, + "ISO_8859-14": enc110, + "iso_8859-14": enc110, + "latin8": enc110, + "iso-celtic": enc110, + "l8": enc110, + "csISO885914": enc110, + "csiso885914": enc110, + "ISO-8859-15": enc111, + "iso-8859-15": enc111, + "ISO_8859-15": enc111, + "iso_8859-15": enc111, + "Latin-9": enc111, + "latin-9": enc111, + "csISO885915": enc111, + "csiso885915": enc111, + "ISO-8859-16": enc112, + "iso-8859-16": enc112, + "iso-ir-226": enc112, + "ISO_8859-16:2001": enc112, + "iso_8859-16:2001": enc112, + "ISO_8859-16": enc112, + "iso_8859-16": enc112, + "latin10": enc112, + "l10": enc112, + "csISO885916": enc112, + "csiso885916": enc112, + "GBK": enc113, + "gbk": enc113, + "CP936": enc113, + "cp936": enc113, + "MS936": enc113, + "ms936": enc113, + "windows-936": enc113, + "csGBK": enc113, + "csgbk": enc113, + "GB18030": enc114, + "gb18030": enc114, + "csGB18030": enc114, + "csgb18030": enc114, + "OSD_EBCDIC_DF04_15": enc115, + "osd_ebcdic_df04_15": enc115, + "csOSDEBCDICDF0415": enc115, + "csosdebcdicdf0415": enc115, + "OSD_EBCDIC_DF03_IRV": enc116, + "osd_ebcdic_df03_irv": enc116, + "csOSDEBCDICDF03IRV": enc116, + "csosdebcdicdf03irv": enc116, + "OSD_EBCDIC_DF04_1": enc117, + "osd_ebcdic_df04_1": enc117, + "csOSDEBCDICDF041": enc117, + "csosdebcdicdf041": enc117, + "ISO-11548-1": enc118, + "iso-11548-1": enc118, + "ISO_11548-1": enc118, + "iso_11548-1": enc118, + "ISO_TR_11548-1": enc118, + "iso_tr_11548-1": enc118, + "csISO115481": enc118, + "csiso115481": enc118, + "KZ-1048": enc119, + "kz-1048": enc119, + "STRK1048-2002": enc119, + "strk1048-2002": enc119, + "RK1048": enc119, + "rk1048": enc119, + "csKZ1048": enc119, + "cskz1048": enc119, + "ISO-10646-UCS-2": enc1000, + "iso-10646-ucs-2": enc1000, + "csUnicode": enc1000, + "csunicode": enc1000, + "ISO-10646-UCS-4": enc1001, + "iso-10646-ucs-4": enc1001, + "csUCS4": enc1001, + "csucs4": enc1001, + "ISO-10646-UCS-Basic": enc1002, + "iso-10646-ucs-basic": enc1002, + "csUnicodeASCII": enc1002, + "csunicodeascii": enc1002, + "ISO-10646-Unicode-Latin1": enc1003, + "iso-10646-unicode-latin1": enc1003, + "csUnicodeLatin1": enc1003, + "csunicodelatin1": enc1003, + "ISO-10646": enc1003, + "iso-10646": enc1003, + "ISO-10646-J-1": enc1004, + "iso-10646-j-1": enc1004, + "csUnicodeJapanese": enc1004, + "csunicodejapanese": enc1004, + "ISO-Unicode-IBM-1261": enc1005, + "iso-unicode-ibm-1261": enc1005, + "csUnicodeIBM1261": enc1005, + "csunicodeibm1261": enc1005, + "ISO-Unicode-IBM-1268": enc1006, + "iso-unicode-ibm-1268": enc1006, + "csUnicodeIBM1268": enc1006, + "csunicodeibm1268": enc1006, + "ISO-Unicode-IBM-1276": enc1007, + "iso-unicode-ibm-1276": enc1007, + "csUnicodeIBM1276": enc1007, + "csunicodeibm1276": enc1007, + "ISO-Unicode-IBM-1264": enc1008, + "iso-unicode-ibm-1264": enc1008, + "csUnicodeIBM1264": enc1008, + "csunicodeibm1264": enc1008, + "ISO-Unicode-IBM-1265": enc1009, + "iso-unicode-ibm-1265": enc1009, + "csUnicodeIBM1265": enc1009, + "csunicodeibm1265": enc1009, + "UNICODE-1-1": enc1010, + "unicode-1-1": enc1010, + "csUnicode11": enc1010, + "csunicode11": enc1010, + "SCSU": enc1011, + "scsu": enc1011, + "csSCSU": enc1011, + "csscsu": enc1011, + "UTF-7": enc1012, + "utf-7": enc1012, + "csUTF7": enc1012, + "csutf7": enc1012, + "UTF-16BE": enc1013, + "utf-16be": enc1013, + "csUTF16BE": enc1013, + "csutf16be": enc1013, + "UTF-16LE": enc1014, + "utf-16le": enc1014, + "csUTF16LE": enc1014, + "csutf16le": enc1014, + "UTF-16": enc1015, + "utf-16": enc1015, + "csUTF16": enc1015, + "csutf16": enc1015, + "CESU-8": enc1016, + "cesu-8": enc1016, + "csCESU8": enc1016, + "cscesu8": enc1016, + "csCESU-8": enc1016, + "cscesu-8": enc1016, + "UTF-32": enc1017, + "utf-32": enc1017, + "csUTF32": enc1017, + "csutf32": enc1017, + "UTF-32BE": enc1018, + "utf-32be": enc1018, + "csUTF32BE": enc1018, + "csutf32be": enc1018, + "UTF-32LE": enc1019, + "utf-32le": enc1019, + "csUTF32LE": enc1019, + "csutf32le": enc1019, + "BOCU-1": enc1020, + "bocu-1": enc1020, + "csBOCU1": enc1020, + "csbocu1": enc1020, + "csBOCU-1": enc1020, + "csbocu-1": enc1020, + "ISO-8859-1-Windows-3.0-Latin-1": enc2000, + "iso-8859-1-windows-3.0-latin-1": enc2000, + "csWindows30Latin1": enc2000, + "cswindows30latin1": enc2000, + "ISO-8859-1-Windows-3.1-Latin-1": enc2001, + "iso-8859-1-windows-3.1-latin-1": enc2001, + "csWindows31Latin1": enc2001, + "cswindows31latin1": enc2001, + "ISO-8859-2-Windows-Latin-2": enc2002, + "iso-8859-2-windows-latin-2": enc2002, + "csWindows31Latin2": enc2002, + "cswindows31latin2": enc2002, + "ISO-8859-9-Windows-Latin-5": enc2003, + "iso-8859-9-windows-latin-5": enc2003, + "csWindows31Latin5": enc2003, + "cswindows31latin5": enc2003, + "hp-roman8": enc2004, + "roman8": enc2004, + "r8": enc2004, + "csHPRoman8": enc2004, + "cshproman8": enc2004, + "Adobe-Standard-Encoding": enc2005, + "adobe-standard-encoding": enc2005, + "csAdobeStandardEncoding": enc2005, + "csadobestandardencoding": enc2005, + "Ventura-US": enc2006, + "ventura-us": enc2006, + "csVenturaUS": enc2006, + "csventuraus": enc2006, + "Ventura-International": enc2007, + "ventura-international": enc2007, + "csVenturaInternational": enc2007, + "csventurainternational": enc2007, + "DEC-MCS": enc2008, + "dec-mcs": enc2008, + "dec": enc2008, + "csDECMCS": enc2008, + "csdecmcs": enc2008, + "IBM850": enc2009, + "ibm850": enc2009, + "cp850": enc2009, + "850": enc2009, + "csPC850Multilingual": enc2009, + "cspc850multilingual": enc2009, + "PC8-Danish-Norwegian": enc2012, + "pc8-danish-norwegian": enc2012, + "csPC8DanishNorwegian": enc2012, + "cspc8danishnorwegian": enc2012, + "IBM862": enc2013, + "ibm862": enc2013, + "cp862": enc2013, + "862": enc2013, + "csPC862LatinHebrew": enc2013, + "cspc862latinhebrew": enc2013, + "PC8-Turkish": enc2014, + "pc8-turkish": enc2014, + "csPC8Turkish": enc2014, + "cspc8turkish": enc2014, + "IBM-Symbols": enc2015, + "ibm-symbols": enc2015, + "csIBMSymbols": enc2015, + "csibmsymbols": enc2015, + "IBM-Thai": enc2016, + "ibm-thai": enc2016, + "csIBMThai": enc2016, + "csibmthai": enc2016, + "HP-Legal": enc2017, + "hp-legal": enc2017, + "csHPLegal": enc2017, + "cshplegal": enc2017, + "HP-Pi-font": enc2018, + "hp-pi-font": enc2018, + "csHPPiFont": enc2018, + "cshppifont": enc2018, + "HP-Math8": enc2019, + "hp-math8": enc2019, + "csHPMath8": enc2019, + "cshpmath8": enc2019, + "Adobe-Symbol-Encoding": enc2020, + "adobe-symbol-encoding": enc2020, + "csHPPSMath": enc2020, + "cshppsmath": enc2020, + "HP-DeskTop": enc2021, + "hp-desktop": enc2021, + "csHPDesktop": enc2021, + "cshpdesktop": enc2021, + "Ventura-Math": enc2022, + "ventura-math": enc2022, + "csVenturaMath": enc2022, + "csventuramath": enc2022, + "Microsoft-Publishing": enc2023, + "microsoft-publishing": enc2023, + "csMicrosoftPublishing": enc2023, + "csmicrosoftpublishing": enc2023, + "Windows-31J": enc2024, + "windows-31j": enc2024, + "csWindows31J": enc2024, + "cswindows31j": enc2024, + "GB2312": enc2025, + "gb2312": enc2025, + "csGB2312": enc2025, + "csgb2312": enc2025, + "Big5": enc2026, + "big5": enc2026, + "csBig5": enc2026, + "csbig5": enc2026, + "macintosh": enc2027, + "mac": enc2027, + "csMacintosh": enc2027, + "csmacintosh": enc2027, + "IBM037": enc2028, + "ibm037": enc2028, + "cp037": enc2028, + "ebcdic-cp-us": enc2028, + "ebcdic-cp-ca": enc2028, + "ebcdic-cp-wt": enc2028, + "ebcdic-cp-nl": enc2028, + "csIBM037": enc2028, + "csibm037": enc2028, + "IBM038": enc2029, + "ibm038": enc2029, + "EBCDIC-INT": enc2029, + "ebcdic-int": enc2029, + "cp038": enc2029, + "csIBM038": enc2029, + "csibm038": enc2029, + "IBM273": enc2030, + "ibm273": enc2030, + "CP273": enc2030, + "cp273": enc2030, + "csIBM273": enc2030, + "csibm273": enc2030, + "IBM274": enc2031, + "ibm274": enc2031, + "EBCDIC-BE": enc2031, + "ebcdic-be": enc2031, + "CP274": enc2031, + "cp274": enc2031, + "csIBM274": enc2031, + "csibm274": enc2031, + "IBM275": enc2032, + "ibm275": enc2032, + "EBCDIC-BR": enc2032, + "ebcdic-br": enc2032, + "cp275": enc2032, + "csIBM275": enc2032, + "csibm275": enc2032, + "IBM277": enc2033, + "ibm277": enc2033, + "EBCDIC-CP-DK": enc2033, + "ebcdic-cp-dk": enc2033, + "EBCDIC-CP-NO": enc2033, + "ebcdic-cp-no": enc2033, + "csIBM277": enc2033, + "csibm277": enc2033, + "IBM278": enc2034, + "ibm278": enc2034, + "CP278": enc2034, + "cp278": enc2034, + "ebcdic-cp-fi": enc2034, + "ebcdic-cp-se": enc2034, + "csIBM278": enc2034, + "csibm278": enc2034, + "IBM280": enc2035, + "ibm280": enc2035, + "CP280": enc2035, + "cp280": enc2035, + "ebcdic-cp-it": enc2035, + "csIBM280": enc2035, + "csibm280": enc2035, + "IBM281": enc2036, + "ibm281": enc2036, + "EBCDIC-JP-E": enc2036, + "ebcdic-jp-e": enc2036, + "cp281": enc2036, + "csIBM281": enc2036, + "csibm281": enc2036, + "IBM284": enc2037, + "ibm284": enc2037, + "CP284": enc2037, + "cp284": enc2037, + "ebcdic-cp-es": enc2037, + "csIBM284": enc2037, + "csibm284": enc2037, + "IBM285": enc2038, + "ibm285": enc2038, + "CP285": enc2038, + "cp285": enc2038, + "ebcdic-cp-gb": enc2038, + "csIBM285": enc2038, + "csibm285": enc2038, + "IBM290": enc2039, + "ibm290": enc2039, + "cp290": enc2039, + "EBCDIC-JP-kana": enc2039, + "ebcdic-jp-kana": enc2039, + "csIBM290": enc2039, + "csibm290": enc2039, + "IBM297": enc2040, + "ibm297": enc2040, + "cp297": enc2040, + "ebcdic-cp-fr": enc2040, + "csIBM297": enc2040, + "csibm297": enc2040, + "IBM420": enc2041, + "ibm420": enc2041, + "cp420": enc2041, + "ebcdic-cp-ar1": enc2041, + "csIBM420": enc2041, + "csibm420": enc2041, + "IBM423": enc2042, + "ibm423": enc2042, + "cp423": enc2042, + "ebcdic-cp-gr": enc2042, + "csIBM423": enc2042, + "csibm423": enc2042, + "IBM424": enc2043, + "ibm424": enc2043, + "cp424": enc2043, + "ebcdic-cp-he": enc2043, + "csIBM424": enc2043, + "csibm424": enc2043, + "IBM437": enc2011, + "ibm437": enc2011, + "cp437": enc2011, + "437": enc2011, + "csPC8CodePage437": enc2011, + "cspc8codepage437": enc2011, + "IBM500": enc2044, + "ibm500": enc2044, + "CP500": enc2044, + "cp500": enc2044, + "ebcdic-cp-be": enc2044, + "ebcdic-cp-ch": enc2044, + "csIBM500": enc2044, + "csibm500": enc2044, + "IBM851": enc2045, + "ibm851": enc2045, + "cp851": enc2045, + "851": enc2045, + "csIBM851": enc2045, + "csibm851": enc2045, + "IBM852": enc2010, + "ibm852": enc2010, + "cp852": enc2010, + "852": enc2010, + "csPCp852": enc2010, + "cspcp852": enc2010, + "IBM855": enc2046, + "ibm855": enc2046, + "cp855": enc2046, + "855": enc2046, + "csIBM855": enc2046, + "csibm855": enc2046, + "IBM857": enc2047, + "ibm857": enc2047, + "cp857": enc2047, + "857": enc2047, + "csIBM857": enc2047, + "csibm857": enc2047, + "IBM860": enc2048, + "ibm860": enc2048, + "cp860": enc2048, + "860": enc2048, + "csIBM860": enc2048, + "csibm860": enc2048, + "IBM861": enc2049, + "ibm861": enc2049, + "cp861": enc2049, + "861": enc2049, + "cp-is": enc2049, + "csIBM861": enc2049, + "csibm861": enc2049, + "IBM863": enc2050, + "ibm863": enc2050, + "cp863": enc2050, + "863": enc2050, + "csIBM863": enc2050, + "csibm863": enc2050, + "IBM864": enc2051, + "ibm864": enc2051, + "cp864": enc2051, + "csIBM864": enc2051, + "csibm864": enc2051, + "IBM865": enc2052, + "ibm865": enc2052, + "cp865": enc2052, + "865": enc2052, + "csIBM865": enc2052, + "csibm865": enc2052, + "IBM868": enc2053, + "ibm868": enc2053, + "CP868": enc2053, + "cp868": enc2053, + "cp-ar": enc2053, + "csIBM868": enc2053, + "csibm868": enc2053, + "IBM869": enc2054, + "ibm869": enc2054, + "cp869": enc2054, + "869": enc2054, + "cp-gr": enc2054, + "csIBM869": enc2054, + "csibm869": enc2054, + "IBM870": enc2055, + "ibm870": enc2055, + "CP870": enc2055, + "cp870": enc2055, + "ebcdic-cp-roece": enc2055, + "ebcdic-cp-yu": enc2055, + "csIBM870": enc2055, + "csibm870": enc2055, + "IBM871": enc2056, + "ibm871": enc2056, + "CP871": enc2056, + "cp871": enc2056, + "ebcdic-cp-is": enc2056, + "csIBM871": enc2056, + "csibm871": enc2056, + "IBM880": enc2057, + "ibm880": enc2057, + "cp880": enc2057, + "EBCDIC-Cyrillic": enc2057, + "ebcdic-cyrillic": enc2057, + "csIBM880": enc2057, + "csibm880": enc2057, + "IBM891": enc2058, + "ibm891": enc2058, + "cp891": enc2058, + "csIBM891": enc2058, + "csibm891": enc2058, + "IBM903": enc2059, + "ibm903": enc2059, + "cp903": enc2059, + "csIBM903": enc2059, + "csibm903": enc2059, + "IBM904": enc2060, + "ibm904": enc2060, + "cp904": enc2060, + "904": enc2060, + "csIBBM904": enc2060, + "csibbm904": enc2060, + "IBM905": enc2061, + "ibm905": enc2061, + "CP905": enc2061, + "cp905": enc2061, + "ebcdic-cp-tr": enc2061, + "csIBM905": enc2061, + "csibm905": enc2061, + "IBM918": enc2062, + "ibm918": enc2062, + "CP918": enc2062, + "cp918": enc2062, + "ebcdic-cp-ar2": enc2062, + "csIBM918": enc2062, + "csibm918": enc2062, + "IBM1026": enc2063, + "ibm1026": enc2063, + "CP1026": enc2063, + "cp1026": enc2063, + "csIBM1026": enc2063, + "csibm1026": enc2063, + "EBCDIC-AT-DE": enc2064, + "ebcdic-at-de": enc2064, + "csIBMEBCDICATDE": enc2064, + "csibmebcdicatde": enc2064, + "EBCDIC-AT-DE-A": enc2065, + "ebcdic-at-de-a": enc2065, + "csEBCDICATDEA": enc2065, + "csebcdicatdea": enc2065, + "EBCDIC-CA-FR": enc2066, + "ebcdic-ca-fr": enc2066, + "csEBCDICCAFR": enc2066, + "csebcdiccafr": enc2066, + "EBCDIC-DK-NO": enc2067, + "ebcdic-dk-no": enc2067, + "csEBCDICDKNO": enc2067, + "csebcdicdkno": enc2067, + "EBCDIC-DK-NO-A": enc2068, + "ebcdic-dk-no-a": enc2068, + "csEBCDICDKNOA": enc2068, + "csebcdicdknoa": enc2068, + "EBCDIC-FI-SE": enc2069, + "ebcdic-fi-se": enc2069, + "csEBCDICFISE": enc2069, + "csebcdicfise": enc2069, + "EBCDIC-FI-SE-A": enc2070, + "ebcdic-fi-se-a": enc2070, + "csEBCDICFISEA": enc2070, + "csebcdicfisea": enc2070, + "EBCDIC-FR": enc2071, + "ebcdic-fr": enc2071, + "csEBCDICFR": enc2071, + "csebcdicfr": enc2071, + "EBCDIC-IT": enc2072, + "ebcdic-it": enc2072, + "csEBCDICIT": enc2072, + "csebcdicit": enc2072, + "EBCDIC-PT": enc2073, + "ebcdic-pt": enc2073, + "csEBCDICPT": enc2073, + "csebcdicpt": enc2073, + "EBCDIC-ES": enc2074, + "ebcdic-es": enc2074, + "csEBCDICES": enc2074, + "csebcdices": enc2074, + "EBCDIC-ES-A": enc2075, + "ebcdic-es-a": enc2075, + "csEBCDICESA": enc2075, + "csebcdicesa": enc2075, + "EBCDIC-ES-S": enc2076, + "ebcdic-es-s": enc2076, + "csEBCDICESS": enc2076, + "csebcdicess": enc2076, + "EBCDIC-UK": enc2077, + "ebcdic-uk": enc2077, + "csEBCDICUK": enc2077, + "csebcdicuk": enc2077, + "EBCDIC-US": enc2078, + "ebcdic-us": enc2078, + "csEBCDICUS": enc2078, + "csebcdicus": enc2078, + "UNKNOWN-8BIT": enc2079, + "unknown-8bit": enc2079, + "csUnknown8BiT": enc2079, + "csunknown8bit": enc2079, + "MNEMONIC": enc2080, + "mnemonic": enc2080, + "csMnemonic": enc2080, + "csmnemonic": enc2080, + "MNEM": enc2081, + "mnem": enc2081, + "csMnem": enc2081, + "csmnem": enc2081, + "VISCII": enc2082, + "viscii": enc2082, + "csVISCII": enc2082, + "csviscii": enc2082, + "VIQR": enc2083, + "viqr": enc2083, + "csVIQR": enc2083, + "csviqr": enc2083, + "KOI8-R": enc2084, + "koi8-r": enc2084, + "csKOI8R": enc2084, + "cskoi8r": enc2084, + "HZ-GB-2312": enc2085, + "hz-gb-2312": enc2085, + "IBM866": enc2086, + "ibm866": enc2086, + "cp866": enc2086, + "866": enc2086, + "csIBM866": enc2086, + "csibm866": enc2086, + "IBM775": enc2087, + "ibm775": enc2087, + "cp775": enc2087, + "csPC775Baltic": enc2087, + "cspc775baltic": enc2087, + "KOI8-U": enc2088, + "koi8-u": enc2088, + "csKOI8U": enc2088, + "cskoi8u": enc2088, + "IBM00858": enc2089, + "ibm00858": enc2089, + "CCSID00858": enc2089, + "ccsid00858": enc2089, + "CP00858": enc2089, + "cp00858": enc2089, + "PC-Multilingual-850+euro": enc2089, + "pc-multilingual-850+euro": enc2089, + "csIBM00858": enc2089, + "csibm00858": enc2089, + "IBM00924": enc2090, + "ibm00924": enc2090, + "CCSID00924": enc2090, + "ccsid00924": enc2090, + "CP00924": enc2090, + "cp00924": enc2090, + "ebcdic-Latin9--euro": enc2090, + "ebcdic-latin9--euro": enc2090, + "csIBM00924": enc2090, + "csibm00924": enc2090, + "IBM01140": enc2091, + "ibm01140": enc2091, + "CCSID01140": enc2091, + "ccsid01140": enc2091, + "CP01140": enc2091, + "cp01140": enc2091, + "ebcdic-us-37+euro": enc2091, + "csIBM01140": enc2091, + "csibm01140": enc2091, + "IBM01141": enc2092, + "ibm01141": enc2092, + "CCSID01141": enc2092, + "ccsid01141": enc2092, + "CP01141": enc2092, + "cp01141": enc2092, + "ebcdic-de-273+euro": enc2092, + "csIBM01141": enc2092, + "csibm01141": enc2092, + "IBM01142": enc2093, + "ibm01142": enc2093, + "CCSID01142": enc2093, + "ccsid01142": enc2093, + "CP01142": enc2093, + "cp01142": enc2093, + "ebcdic-dk-277+euro": enc2093, + "ebcdic-no-277+euro": enc2093, + "csIBM01142": enc2093, + "csibm01142": enc2093, + "IBM01143": enc2094, + "ibm01143": enc2094, + "CCSID01143": enc2094, + "ccsid01143": enc2094, + "CP01143": enc2094, + "cp01143": enc2094, + "ebcdic-fi-278+euro": enc2094, + "ebcdic-se-278+euro": enc2094, + "csIBM01143": enc2094, + "csibm01143": enc2094, + "IBM01144": enc2095, + "ibm01144": enc2095, + "CCSID01144": enc2095, + "ccsid01144": enc2095, + "CP01144": enc2095, + "cp01144": enc2095, + "ebcdic-it-280+euro": enc2095, + "csIBM01144": enc2095, + "csibm01144": enc2095, + "IBM01145": enc2096, + "ibm01145": enc2096, + "CCSID01145": enc2096, + "ccsid01145": enc2096, + "CP01145": enc2096, + "cp01145": enc2096, + "ebcdic-es-284+euro": enc2096, + "csIBM01145": enc2096, + "csibm01145": enc2096, + "IBM01146": enc2097, + "ibm01146": enc2097, + "CCSID01146": enc2097, + "ccsid01146": enc2097, + "CP01146": enc2097, + "cp01146": enc2097, + "ebcdic-gb-285+euro": enc2097, + "csIBM01146": enc2097, + "csibm01146": enc2097, + "IBM01147": enc2098, + "ibm01147": enc2098, + "CCSID01147": enc2098, + "ccsid01147": enc2098, + "CP01147": enc2098, + "cp01147": enc2098, + "ebcdic-fr-297+euro": enc2098, + "csIBM01147": enc2098, + "csibm01147": enc2098, + "IBM01148": enc2099, + "ibm01148": enc2099, + "CCSID01148": enc2099, + "ccsid01148": enc2099, + "CP01148": enc2099, + "cp01148": enc2099, + "ebcdic-international-500+euro": enc2099, + "csIBM01148": enc2099, + "csibm01148": enc2099, + "IBM01149": enc2100, + "ibm01149": enc2100, + "CCSID01149": enc2100, + "ccsid01149": enc2100, + "CP01149": enc2100, + "cp01149": enc2100, + "ebcdic-is-871+euro": enc2100, + "csIBM01149": enc2100, + "csibm01149": enc2100, + "Big5-HKSCS": enc2101, + "big5-hkscs": enc2101, + "csBig5HKSCS": enc2101, + "csbig5hkscs": enc2101, + "IBM1047": enc2102, + "ibm1047": enc2102, + "IBM-1047": enc2102, + "ibm-1047": enc2102, + "csIBM1047": enc2102, + "csibm1047": enc2102, + "PTCP154": enc2103, + "ptcp154": enc2103, + "csPTCP154": enc2103, + "csptcp154": enc2103, + "PT154": enc2103, + "pt154": enc2103, + "CP154": enc2103, + "cp154": enc2103, + "Cyrillic-Asian": enc2103, + "cyrillic-asian": enc2103, + "Amiga-1251": enc2104, + "amiga-1251": enc2104, + "Ami1251": enc2104, + "ami1251": enc2104, + "Amiga1251": enc2104, + "amiga1251": enc2104, + "Ami-1251": enc2104, + "ami-1251": enc2104, + "csAmiga1251\n(Aliases": enc2104, + "csamiga1251\n(aliases": enc2104, + "KOI7-switched": enc2105, + "koi7-switched": enc2105, + "csKOI7switched": enc2105, + "cskoi7switched": enc2105, + "BRF": enc2106, + "brf": enc2106, + "csBRF": enc2106, + "csbrf": enc2106, + "TSCII": enc2107, + "tscii": enc2107, + "csTSCII": enc2107, + "cstscii": enc2107, + "CP51932": enc2108, + "cp51932": enc2108, + "csCP51932": enc2108, + "cscp51932": enc2108, + "windows-874": enc2109, + "cswindows874": enc2109, + "windows-1250": enc2250, + "cswindows1250": enc2250, + "windows-1251": enc2251, + "cswindows1251": enc2251, + "windows-1252": enc2252, + "cswindows1252": enc2252, + "windows-1253": enc2253, + "cswindows1253": enc2253, + "windows-1254": enc2254, + "cswindows1254": enc2254, + "windows-1255": enc2255, + "cswindows1255": enc2255, + "windows-1256": enc2256, + "cswindows1256": enc2256, + "windows-1257": enc2257, + "cswindows1257": enc2257, + "windows-1258": enc2258, + "cswindows1258": enc2258, + "TIS-620": enc2259, + "tis-620": enc2259, + "csTIS620": enc2259, + "cstis620": enc2259, + "ISO-8859-11": enc2259, + "iso-8859-11": enc2259, + "CP50220": enc2260, + "cp50220": enc2260, + "csCP50220": enc2260, + "cscp50220": enc2260, +} + +// Total table size 14402 bytes (14KiB); checksum: CEBAA10C diff --git a/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go b/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go new file mode 100644 index 00000000..0cccae04 --- /dev/null +++ b/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go @@ -0,0 +1,180 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package enctest + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "strings" + "testing" + + "golang.org/x/text/encoding" + "golang.org/x/text/encoding/internal/identifier" + "golang.org/x/text/transform" +) + +// Encoder or Decoder +type Transcoder interface { + transform.Transformer + Bytes([]byte) ([]byte, error) + String(string) (string, error) +} + +func TestEncoding(t *testing.T, e encoding.Encoding, encoded, utf8, prefix, suffix string) { + for _, direction := range []string{"Decode", "Encode"} { + t.Run(fmt.Sprintf("%v/%s", e, direction), func(t *testing.T) { + + var coder Transcoder + var want, src, wPrefix, sPrefix, wSuffix, sSuffix string + if direction == "Decode" { + coder, want, src = e.NewDecoder(), utf8, encoded + wPrefix, sPrefix, wSuffix, sSuffix = "", prefix, "", suffix + } else { + coder, want, src = e.NewEncoder(), encoded, utf8 + wPrefix, sPrefix, wSuffix, sSuffix = prefix, "", suffix, "" + } + + dst := make([]byte, len(wPrefix)+len(want)+len(wSuffix)) + nDst, nSrc, err := coder.Transform(dst, []byte(sPrefix+src+sSuffix), true) + if err != nil { + t.Fatal(err) + } + if nDst != len(wPrefix)+len(want)+len(wSuffix) { + t.Fatalf("nDst got %d, want %d", + nDst, len(wPrefix)+len(want)+len(wSuffix)) + } + if nSrc != len(sPrefix)+len(src)+len(sSuffix) { + t.Fatalf("nSrc got %d, want %d", + nSrc, len(sPrefix)+len(src)+len(sSuffix)) + } + if got := string(dst); got != wPrefix+want+wSuffix { + t.Fatalf("\ngot %q\nwant %q", got, wPrefix+want+wSuffix) + } + + for _, n := range []int{0, 1, 2, 10, 123, 4567} { + input := sPrefix + strings.Repeat(src, n) + sSuffix + g, err := coder.String(input) + if err != nil { + t.Fatalf("Bytes: n=%d: %v", n, err) + } + if len(g) == 0 && len(input) == 0 { + // If the input is empty then the output can be empty, + // regardless of whatever wPrefix is. + continue + } + got1, want1 := string(g), wPrefix+strings.Repeat(want, n)+wSuffix + if got1 != want1 { + t.Fatalf("ReadAll: n=%d\ngot %q\nwant %q", + n, trim(got1), trim(want1)) + } + } + }) + } +} + +func TestFile(t *testing.T, e encoding.Encoding) { + for _, dir := range []string{"Decode", "Encode"} { + t.Run(fmt.Sprintf("%s/%s", e, dir), func(t *testing.T) { + dst, src, transformer, err := load(dir, e) + if err != nil { + t.Fatalf("load: %v", err) + } + buf, err := transformer.Bytes(src) + if err != nil { + t.Fatalf("transform: %v", err) + } + if !bytes.Equal(buf, dst) { + t.Error("transformed bytes did not match golden file") + } + }) + } +} + +func Benchmark(b *testing.B, enc encoding.Encoding) { + for _, direction := range []string{"Decode", "Encode"} { + b.Run(fmt.Sprintf("%s/%s", enc, direction), func(b *testing.B) { + _, src, transformer, err := load(direction, enc) + if err != nil { + b.Fatal(err) + } + b.SetBytes(int64(len(src))) + b.ResetTimer() + for i := 0; i < b.N; i++ { + r := transform.NewReader(bytes.NewReader(src), transformer) + io.Copy(ioutil.Discard, r) + } + }) + } +} + +// testdataFiles are files in testdata/*.txt. +var testdataFiles = []struct { + mib identifier.MIB + basename, ext string +}{ + {identifier.Windows1252, "candide", "windows-1252"}, + {identifier.EUCPkdFmtJapanese, "rashomon", "euc-jp"}, + {identifier.ISO2022JP, "rashomon", "iso-2022-jp"}, + {identifier.ShiftJIS, "rashomon", "shift-jis"}, + {identifier.EUCKR, "unsu-joh-eun-nal", "euc-kr"}, + {identifier.GBK, "sunzi-bingfa-simplified", "gbk"}, + {identifier.HZGB2312, "sunzi-bingfa-gb-levels-1-and-2", "hz-gb2312"}, + {identifier.Big5, "sunzi-bingfa-traditional", "big5"}, + {identifier.UTF16LE, "candide", "utf-16le"}, + {identifier.UTF8, "candide", "utf-8"}, + {identifier.UTF32BE, "candide", "utf-32be"}, + + // GB18030 is a superset of GBK and is nominally a Simplified Chinese + // encoding, but it can also represent the entire Basic Multilingual + // Plane, including codepoints like 'รข' that aren't encodable by GBK. + // GB18030 on Simplified Chinese should perform similarly to GBK on + // Simplified Chinese. GB18030 on "candide" is more interesting. + {identifier.GB18030, "candide", "gb18030"}, +} + +func load(direction string, enc encoding.Encoding) ([]byte, []byte, Transcoder, error) { + basename, ext, count := "", "", 0 + for _, tf := range testdataFiles { + if mib, _ := enc.(identifier.Interface).ID(); tf.mib == mib { + basename, ext = tf.basename, tf.ext + count++ + } + } + if count != 1 { + if count == 0 { + return nil, nil, nil, fmt.Errorf("no testdataFiles for %s", enc) + } + return nil, nil, nil, fmt.Errorf("too many testdataFiles for %s", enc) + } + dstFile := fmt.Sprintf("../testdata/%s-%s.txt", basename, ext) + srcFile := fmt.Sprintf("../testdata/%s-utf-8.txt", basename) + var coder Transcoder = encoding.ReplaceUnsupported(enc.NewEncoder()) + if direction == "Decode" { + dstFile, srcFile = srcFile, dstFile + coder = enc.NewDecoder() + } + dst, err := ioutil.ReadFile(dstFile) + if err != nil { + if dst, err = ioutil.ReadFile("../" + dstFile); err != nil { + return nil, nil, nil, err + } + } + src, err := ioutil.ReadFile(srcFile) + if err != nil { + if src, err = ioutil.ReadFile("../" + srcFile); err != nil { + return nil, nil, nil, err + } + } + return dst, src, coder, nil +} + +func trim(s string) string { + if len(s) < 120 { + return s + } + return s[:50] + "..." + s[len(s)-50:] +} diff --git a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go index 915abfa2..768842b0 100644 --- a/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +++ b/vendor/golang.org/x/text/encoding/internal/identifier/mib.go @@ -1,4 +1,4 @@ -// This file was generated by go generate; DO NOT EDIT +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. package identifier diff --git a/vendor/golang.org/x/text/encoding/japanese/eucjp.go b/vendor/golang.org/x/text/encoding/japanese/eucjp.go index 40f9b05f..79313fa5 100644 --- a/vendor/golang.org/x/text/encoding/japanese/eucjp.go +++ b/vendor/golang.org/x/text/encoding/japanese/eucjp.go @@ -5,7 +5,6 @@ package japanese import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -23,10 +22,9 @@ var eucJP = internal.Encoding{ identifier.EUCPkdFmtJapanese, } -var errInvalidEUCJP = errors.New("japanese: invalid EUC-JP encoding") - type eucJPDecoder struct{ transform.NopResetter } +// See https://encoding.spec.whatwg.org/#euc-jp-decoder. func (eucJPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { r, size := rune(0), 0 loop: @@ -37,60 +35,79 @@ loop: case c0 == 0x8e: if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + break } c1 := src[nSrc+1] - if c1 < 0xa1 || 0xdf < c1 { - err = errInvalidEUCJP - break loop + switch { + case c1 < 0xa1: + r, size = utf8.RuneError, 1 + case c1 > 0xdf: + r, size = utf8.RuneError, 2 + if c1 == 0xff { + size = 1 + } + default: + r, size = rune(c1)+(0xff61-0xa1), 2 } - r, size = rune(c1)+(0xff61-0xa1), 2 - case c0 == 0x8f: if nSrc+2 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + if p := nSrc + 1; p < len(src) && 0xa1 <= src[p] && src[p] < 0xfe { + size = 2 + } + break } c1 := src[nSrc+1] if c1 < 0xa1 || 0xfe < c1 { - err = errInvalidEUCJP - break loop + r, size = utf8.RuneError, 1 + break } c2 := src[nSrc+2] if c2 < 0xa1 || 0xfe < c2 { - err = errInvalidEUCJP - break loop + r, size = utf8.RuneError, 2 + break } - r, size = '\ufffd', 3 + r, size = utf8.RuneError, 3 if i := int(c1-0xa1)*94 + int(c2-0xa1); i < len(jis0212Decode) { r = rune(jis0212Decode[i]) if r == 0 { - r = '\ufffd' + r = utf8.RuneError } } case 0xa1 <= c0 && c0 <= 0xfe: if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + break } c1 := src[nSrc+1] if c1 < 0xa1 || 0xfe < c1 { - err = errInvalidEUCJP - break loop + r, size = utf8.RuneError, 1 + break } - r, size = '\ufffd', 2 + r, size = utf8.RuneError, 2 if i := int(c0-0xa1)*94 + int(c1-0xa1); i < len(jis0208Decode) { r = rune(jis0208Decode[i]) if r == 0 { - r = '\ufffd' + r = utf8.RuneError } } default: - err = errInvalidEUCJP - break loop + r, size = utf8.RuneError, 1 } if nDst+utf8.RuneLen(r) > len(dst) { @@ -99,9 +116,6 @@ loop: } nDst += utf8.EncodeRune(dst[nDst:], r) } - if atEOF && err == transform.ErrShortSrc { - err = errInvalidEUCJP - } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go b/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go index b63e7d5d..613226df 100644 --- a/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go +++ b/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go @@ -5,7 +5,6 @@ package japanese import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -31,8 +30,6 @@ func iso2022JPNewEncoder() transform.Transformer { return new(iso2022JPEncoder) } -var errInvalidISO2022JP = errors.New("japanese: invalid ISO-2022-JP encoding") - const ( asciiState = iota katakanaState @@ -50,45 +47,51 @@ func (d *iso2022JPDecoder) Reset() { func (d *iso2022JPDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { r, size := rune(0), 0 -loop: for ; nSrc < len(src); nSrc += size { c0 := src[nSrc] if c0 >= utf8.RuneSelf { - err = errInvalidISO2022JP - break loop + r, size = '\ufffd', 1 + goto write } if c0 == asciiEsc { if nSrc+2 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + return nDst, nSrc, transform.ErrShortSrc + } + // TODO: is it correct to only skip 1?? + r, size = '\ufffd', 1 + goto write } size = 3 c1 := src[nSrc+1] c2 := src[nSrc+2] switch { - case c1 == '$' && (c2 == '@' || c2 == 'B'): + case c1 == '$' && (c2 == '@' || c2 == 'B'): // 0x24 {0x40, 0x42} *d = jis0208State continue - case c1 == '$' && c2 == '(': + case c1 == '$' && c2 == '(': // 0x24 0x28 if nSrc+3 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + return nDst, nSrc, transform.ErrShortSrc + } + r, size = '\ufffd', 1 + goto write } size = 4 - if src[nSrc]+3 == 'D' { + if src[nSrc+3] == 'D' { *d = jis0212State continue } - case c1 == '(' && (c2 == 'B' || c2 == 'J'): + case c1 == '(' && (c2 == 'B' || c2 == 'J'): // 0x28 {0x42, 0x4A} *d = asciiState continue - case c1 == '(' && c2 == 'I': + case c1 == '(' && c2 == 'I': // 0x28 0x49 *d = katakanaState continue } - err = errInvalidISO2022JP - break loop + r, size = '\ufffd', 1 + goto write } switch *d { @@ -97,8 +100,8 @@ loop: case katakanaState: if c0 < 0x21 || 0x60 <= c0 { - err = errInvalidISO2022JP - break loop + r, size = '\ufffd', 1 + goto write } r, size = rune(c0)+(0xff61-0x21), 1 @@ -106,11 +109,14 @@ loop: if c0 == 0x0a { *d = asciiState r, size = rune(c0), 1 - break + goto write } if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + return nDst, nSrc, transform.ErrShortSrc + } + r, size = '\ufffd', 1 + goto write } size = 2 c1 := src[nSrc+1] @@ -121,22 +127,19 @@ loop: r = rune(jis0212Decode[i]) } else { r = '\ufffd' - break + goto write } if r == 0 { r = '\ufffd' } } + write: if nDst+utf8.RuneLen(r) > len(dst) { - err = transform.ErrShortDst - break loop + return nDst, nSrc, transform.ErrShortDst } nDst += utf8.EncodeRune(dst[nDst:], r) } - if atEOF && err == transform.ErrShortSrc { - err = errInvalidISO2022JP - } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/japanese/shiftjis.go b/vendor/golang.org/x/text/encoding/japanese/shiftjis.go index 099aecc3..16fd8a6e 100644 --- a/vendor/golang.org/x/text/encoding/japanese/shiftjis.go +++ b/vendor/golang.org/x/text/encoding/japanese/shiftjis.go @@ -5,7 +5,6 @@ package japanese import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -24,8 +23,6 @@ var shiftJIS = internal.Encoding{ identifier.ShiftJIS, } -var errInvalidShiftJIS = errors.New("japanese: invalid Shift JIS encoding") - type shiftJISDecoder struct{ transform.NopResetter } func (shiftJISDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -48,28 +45,32 @@ loop: c0 = 2*c0 - 0x21 if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = '\ufffd', 1 + goto write } c1 := src[nSrc+1] switch { case c1 < 0x40: - err = errInvalidShiftJIS - break loop + r, size = '\ufffd', 1 // c1 is ASCII so output on next round + goto write case c1 < 0x7f: c0-- c1 -= 0x40 case c1 == 0x7f: - err = errInvalidShiftJIS - break loop + r, size = '\ufffd', 1 // c1 is ASCII so output on next round + goto write case c1 < 0x9f: c0-- c1 -= 0x41 case c1 < 0xfd: c1 -= 0x9f default: - err = errInvalidShiftJIS - break loop + r, size = '\ufffd', 2 + goto write } r, size = '\ufffd', 2 if i := int(c0)*94 + int(c1); i < len(jis0208Decode) { @@ -79,20 +80,19 @@ loop: } } + case c0 == 0x80: + r, size = 0x80, 1 + default: - err = errInvalidShiftJIS - break loop + r, size = '\ufffd', 1 } - + write: if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break loop } nDst += utf8.EncodeRune(dst[nDst:], r) } - if atEOF && err == transform.ErrShortSrc { - err = errInvalidShiftJIS - } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/korean/euckr.go b/vendor/golang.org/x/text/encoding/korean/euckr.go index a4b9ff17..034337f5 100644 --- a/vendor/golang.org/x/text/encoding/korean/euckr.go +++ b/vendor/golang.org/x/text/encoding/korean/euckr.go @@ -5,7 +5,6 @@ package korean import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -26,8 +25,6 @@ var eucKR = internal.Encoding{ identifier.EUCKR, } -var errInvalidEUCKR = errors.New("korean: invalid EUC-KR encoding") - type eucKRDecoder struct{ transform.NopResetter } func (eucKRDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -40,10 +37,15 @@ loop: case 0x81 <= c0 && c0 < 0xff: if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + break } c1 := src[nSrc+1] + size = 2 if c0 < 0xc7 { r = 178 * rune(c0-0x81) switch { @@ -54,39 +56,36 @@ loop: case 0x81 <= c1 && c1 < 0xff: r += rune(c1) - (0x81 - 2*26) default: - err = errInvalidEUCKR - break loop + goto decError } } else if 0xa1 <= c1 && c1 < 0xff { r = 178*(0xc7-0x81) + rune(c0-0xc7)*94 + rune(c1-0xa1) } else { - err = errInvalidEUCKR - break loop + goto decError } if int(r) < len(decode) { r = rune(decode[r]) - if r == 0 { - r = '\ufffd' + if r != 0 { + break } - } else { - r = '\ufffd' } - size = 2 + decError: + r = utf8.RuneError + if c1 < utf8.RuneSelf { + size = 1 + } default: - err = errInvalidEUCKR - break loop + r, size = utf8.RuneError, 1 + break } if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst - break loop + break } nDst += utf8.EncodeRune(dst[nDst:], r) } - if atEOF && err == transform.ErrShortSrc { - err = errInvalidEUCKR - } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go index e0b15bbc..b89c45b0 100644 --- a/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go +++ b/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go @@ -5,7 +5,6 @@ package simplifiedchinese import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -40,11 +39,6 @@ var gbk18030 = internal.Encoding{ identifier.GB18030, } -var ( - errInvalidGB18030 = errors.New("simplifiedchinese: invalid GB18030 encoding") - errInvalidGBK = errors.New("simplifiedchinese: invalid GBK encoding") -) - type gbkDecoder struct { transform.NopResetter gb18030 bool @@ -66,8 +60,12 @@ loop: case c0 < 0xff: if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + goto write } c1 := src[nSrc+1] switch { @@ -77,18 +75,24 @@ loop: c1 -= 0x41 case d.gb18030 && 0x30 <= c1 && c1 < 0x40: if nSrc+3 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + // The second byte here is always ASCII, so we can set size + // to 1 in all cases. + r, size = utf8.RuneError, 1 + goto write } c2 := src[nSrc+2] if c2 < 0x81 || 0xff <= c2 { - err = errInvalidGB18030 - break loop + r, size = utf8.RuneError, 1 + goto write } c3 := src[nSrc+3] if c3 < 0x30 || 0x3a <= c3 { - err = errInvalidGB18030 - break loop + r, size = utf8.RuneError, 1 + goto write } size = 4 r = ((rune(c0-0x81)*10+rune(c1-0x30))*126+rune(c2-0x81))*10 + rune(c3-0x30) @@ -109,17 +113,13 @@ loop: r -= 189000 if 0 <= r && r < 0x100000 { r += 0x10000 - goto write - } - err = errInvalidGB18030 - break loop - default: - if d.gb18030 { - err = errInvalidGB18030 } else { - err = errInvalidGBK + r, size = utf8.RuneError, 1 } - break loop + goto write + default: + r, size = utf8.RuneError, 1 + goto write } r, size = '\ufffd', 2 if i := int(c0-0x81)*190 + int(c1); i < len(decode) { @@ -130,12 +130,7 @@ loop: } default: - if d.gb18030 { - err = errInvalidGB18030 - } else { - err = errInvalidGBK - } - break loop + r, size = utf8.RuneError, 1 } write: @@ -145,13 +140,6 @@ loop: } nDst += utf8.EncodeRune(dst[nDst:], r) } - if atEOF && err == transform.ErrShortSrc { - if d.gb18030 { - err = errInvalidGB18030 - } else { - err = errInvalidGBK - } - } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go b/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go index 85de6b1e..eb3157f0 100644 --- a/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go +++ b/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go @@ -5,7 +5,6 @@ package simplifiedchinese import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -31,8 +30,6 @@ func hzGB2312NewEncoder() transform.Transformer { return new(hzGB2312Encoder) } -var errInvalidHZGB2312 = errors.New("simplifiedchinese: invalid HZ-GB2312 encoding") - const ( asciiState = iota gbState @@ -50,14 +47,18 @@ loop: for ; nSrc < len(src); nSrc += size { c0 := src[nSrc] if c0 >= utf8.RuneSelf { - err = errInvalidHZGB2312 - break loop + r, size = utf8.RuneError, 1 + goto write } if c0 == '~' { if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r = utf8.RuneError + goto write } size = 2 switch src[nSrc+1] { @@ -78,8 +79,8 @@ loop: case '\n': continue default: - err = errInvalidHZGB2312 - break loop + r = utf8.RuneError + goto write } } @@ -87,33 +88,37 @@ loop: r, size = rune(c0), 1 } else { if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + goto write } + size = 2 c1 := src[nSrc+1] if c0 < 0x21 || 0x7e <= c0 || c1 < 0x21 || 0x7f <= c1 { - err = errInvalidHZGB2312 - break loop - } - - r, size = '\ufffd', 2 - if i := int(c0-0x01)*190 + int(c1+0x3f); i < len(decode) { + // error + } else if i := int(c0-0x01)*190 + int(c1+0x3f); i < len(decode) { r = rune(decode[i]) - if r == 0 { - r = '\ufffd' + if r != 0 { + goto write } } + if c1 > utf8.RuneSelf { + // Be consistent and always treat non-ASCII as a single error. + size = 1 + } + r = utf8.RuneError } + write: if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break loop } nDst += utf8.EncodeRune(dst[nDst:], r) } - if atEOF && err == transform.ErrShortSrc { - err = errInvalidHZGB2312 - } return nDst, nSrc, err } diff --git a/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go b/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go index 275821f5..1fcddde0 100644 --- a/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go +++ b/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go @@ -5,7 +5,6 @@ package traditionalchinese import ( - "errors" "unicode/utf8" "golang.org/x/text/encoding" @@ -26,8 +25,6 @@ var big5 = internal.Encoding{ identifier.Big5, } -var errInvalidBig5 = errors.New("traditionalchinese: invalid Big5 encoding") - type big5Decoder struct{ transform.NopResetter } func (big5Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { @@ -40,8 +37,12 @@ loop: case 0x81 <= c0 && c0 < 0xff: if nSrc+1 >= len(src) { - err = transform.ErrShortSrc - break loop + if !atEOF { + err = transform.ErrShortSrc + break loop + } + r, size = utf8.RuneError, 1 + goto write } c1 := src[nSrc+1] switch { @@ -49,9 +50,12 @@ loop: c1 -= 0x40 case 0xa1 <= c1 && c1 < 0xff: c1 -= 0x62 + case c1 < 0x40: + r, size = utf8.RuneError, 1 + goto write default: - err = errInvalidBig5 - break loop + r, size = utf8.RuneError, 2 + goto write } r, size = '\ufffd', 2 if i := int(c0-0x81)*157 + int(c1); i < len(decode) { @@ -80,10 +84,10 @@ loop: } default: - err = errInvalidBig5 - break loop + r, size = utf8.RuneError, 1 } + write: if nDst+utf8.RuneLen(r) > len(dst) { err = transform.ErrShortDst break loop @@ -99,9 +103,6 @@ loop: nDst += copy(dst[nDst:], s) continue loop } - if atEOF && err == transform.ErrShortSrc { - err = errInvalidBig5 - } return nDst, nSrc, err } |