var UTF8 … var UTF8BOM … type utf8bomEncoding … func (utf8bomEncoding) String() string { … } func (utf8bomEncoding) ID() (identifier.MIB, string) { … } func (utf8bomEncoding) NewEncoder() *encoding.Encoder { … } func (utf8bomEncoding) NewDecoder() *encoding.Decoder { … } var utf8enc … type utf8bomDecoder … func (t *utf8bomDecoder) Reset() { … } func (t *utf8bomDecoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { … } type utf8bomEncoder … func (t *utf8bomEncoder) Reset() { … } func (t *utf8bomEncoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { … } type utf8Decoder … func (utf8Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { … } // UTF16 returns a UTF-16 Encoding for the given default endianness and byte // order mark (BOM) policy. // // When decoding from UTF-16 to UTF-8, if the BOMPolicy is IgnoreBOM then // neither BOMs U+FEFF nor noncharacters U+FFFE in the input stream will affect // the endianness used for decoding, and will instead be output as their // standard UTF-8 encodings: "\xef\xbb\xbf" and "\xef\xbf\xbe". If the BOMPolicy // is UseBOM or ExpectBOM a staring BOM is not written to the UTF-8 output. // Instead, it overrides the default endianness e for the remainder of the // transformation. Any subsequent BOMs U+FEFF or noncharacters U+FFFE will not // affect the endianness used, and will instead be output as their standard // UTF-8 encodings. For UseBOM, if there is no starting BOM, it will proceed // with the default Endianness. For ExpectBOM, in that case, the transformation // will return early with an ErrMissingBOM error. // // When encoding from UTF-8 to UTF-16, a BOM will be inserted at the start of // the output if the BOMPolicy is UseBOM or ExpectBOM. Otherwise, a BOM will not // be inserted. The UTF-8 input does not need to contain a BOM. // // There is no concept of a 'native' endianness. If the UTF-16 data is produced // and consumed in a greater context that implies a certain endianness, use // IgnoreBOM. Otherwise, use ExpectBOM and always produce and consume a BOM. // // In the language of https://www.unicode.org/faq/utf_bom.html#bom10, IgnoreBOM // corresponds to "Where the precise type of the data stream is known... the // BOM should not be used" and ExpectBOM corresponds to "A particular // protocol... may require use of the BOM". func UTF16(e Endianness, b BOMPolicy) encoding.Encoding { … } var mibValue … var All … type BOMPolicy … const writeBOM … const acceptBOM … const requireBOM … const bomMask … const numBOMValues … const IgnoreBOM … const UseBOM … const ExpectBOM … type Endianness … const BigEndian … const LittleEndian … var ErrMissingBOM … type utf16Encoding … type config … func (u utf16Encoding) NewDecoder() *encoding.Decoder { … } func (u utf16Encoding) NewEncoder() *encoding.Encoder { … } func (u utf16Encoding) ID() (mib identifier.MIB, other string) { … } func (u utf16Encoding) String() string { … } type utf16Decoder … func (u *utf16Decoder) Reset() { … } func (u *utf16Decoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { … } func isHighSurrogate(r rune) bool { … } type utf16Encoder … func (u *utf16Encoder) Reset() { … } func (u *utf16Encoder) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { … }