本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
4.0KB

  1. // Copyright 2015 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package htmlindex
  5. import (
  6. "golang.org/x/text/encoding"
  7. "golang.org/x/text/encoding/charmap"
  8. "golang.org/x/text/encoding/internal/identifier"
  9. "golang.org/x/text/encoding/japanese"
  10. "golang.org/x/text/encoding/korean"
  11. "golang.org/x/text/encoding/simplifiedchinese"
  12. "golang.org/x/text/encoding/traditionalchinese"
  13. "golang.org/x/text/encoding/unicode"
  14. )
  15. // mibMap maps a MIB identifier to an htmlEncoding index.
  16. var mibMap = map[identifier.MIB]htmlEncoding{
  17. identifier.UTF8: utf8,
  18. identifier.UTF16BE: utf16be,
  19. identifier.UTF16LE: utf16le,
  20. identifier.IBM866: ibm866,
  21. identifier.ISOLatin2: iso8859_2,
  22. identifier.ISOLatin3: iso8859_3,
  23. identifier.ISOLatin4: iso8859_4,
  24. identifier.ISOLatinCyrillic: iso8859_5,
  25. identifier.ISOLatinArabic: iso8859_6,
  26. identifier.ISOLatinGreek: iso8859_7,
  27. identifier.ISOLatinHebrew: iso8859_8,
  28. identifier.ISO88598I: iso8859_8I,
  29. identifier.ISOLatin6: iso8859_10,
  30. identifier.ISO885913: iso8859_13,
  31. identifier.ISO885914: iso8859_14,
  32. identifier.ISO885915: iso8859_15,
  33. identifier.ISO885916: iso8859_16,
  34. identifier.KOI8R: koi8r,
  35. identifier.KOI8U: koi8u,
  36. identifier.Macintosh: macintosh,
  37. identifier.MacintoshCyrillic: macintoshCyrillic,
  38. identifier.Windows874: windows874,
  39. identifier.Windows1250: windows1250,
  40. identifier.Windows1251: windows1251,
  41. identifier.Windows1252: windows1252,
  42. identifier.Windows1253: windows1253,
  43. identifier.Windows1254: windows1254,
  44. identifier.Windows1255: windows1255,
  45. identifier.Windows1256: windows1256,
  46. identifier.Windows1257: windows1257,
  47. identifier.Windows1258: windows1258,
  48. identifier.XUserDefined: xUserDefined,
  49. identifier.GBK: gbk,
  50. identifier.GB18030: gb18030,
  51. identifier.Big5: big5,
  52. identifier.EUCPkdFmtJapanese: eucjp,
  53. identifier.ISO2022JP: iso2022jp,
  54. identifier.ShiftJIS: shiftJIS,
  55. identifier.EUCKR: euckr,
  56. identifier.Replacement: replacement,
  57. }
  58. // encodings maps the internal htmlEncoding to an Encoding.
  59. // TODO: consider using a reusable index in encoding/internal.
  60. var encodings = [numEncodings]encoding.Encoding{
  61. utf8: unicode.UTF8,
  62. ibm866: charmap.CodePage866,
  63. iso8859_2: charmap.ISO8859_2,
  64. iso8859_3: charmap.ISO8859_3,
  65. iso8859_4: charmap.ISO8859_4,
  66. iso8859_5: charmap.ISO8859_5,
  67. iso8859_6: charmap.ISO8859_6,
  68. iso8859_7: charmap.ISO8859_7,
  69. iso8859_8: charmap.ISO8859_8,
  70. iso8859_8I: charmap.ISO8859_8I,
  71. iso8859_10: charmap.ISO8859_10,
  72. iso8859_13: charmap.ISO8859_13,
  73. iso8859_14: charmap.ISO8859_14,
  74. iso8859_15: charmap.ISO8859_15,
  75. iso8859_16: charmap.ISO8859_16,
  76. koi8r: charmap.KOI8R,
  77. koi8u: charmap.KOI8U,
  78. macintosh: charmap.Macintosh,
  79. windows874: charmap.Windows874,
  80. windows1250: charmap.Windows1250,
  81. windows1251: charmap.Windows1251,
  82. windows1252: charmap.Windows1252,
  83. windows1253: charmap.Windows1253,
  84. windows1254: charmap.Windows1254,
  85. windows1255: charmap.Windows1255,
  86. windows1256: charmap.Windows1256,
  87. windows1257: charmap.Windows1257,
  88. windows1258: charmap.Windows1258,
  89. macintoshCyrillic: charmap.MacintoshCyrillic,
  90. gbk: simplifiedchinese.GBK,
  91. gb18030: simplifiedchinese.GB18030,
  92. big5: traditionalchinese.Big5,
  93. eucjp: japanese.EUCJP,
  94. iso2022jp: japanese.ISO2022JP,
  95. shiftJIS: japanese.ShiftJIS,
  96. euckr: korean.EUCKR,
  97. replacement: encoding.Replacement,
  98. utf16be: unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM),
  99. utf16le: unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM),
  100. xUserDefined: charmap.XUserDefined,
  101. }
上海开阖软件有限公司 沪ICP备12045867号-1