gitea

Development moved to Codeberg

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
  70. 70
  71. 71
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
  81. 81
  82. 82
  83. 83
  84. 84
  85. 85
  86. 86
  87. 87
  88. 88
  89. 89
  90. 90
  91. 91
  92. 92
  93. 93
  94. 94
  95. 95
  96. 96
  97. 97
  98. 98
  99. 99
  100. 100
  101. 101
  102. 102
  103. 103
  104. 104
  105. 105
// Copyright 2015 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 htmlindex

import (
	"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"
)

// mibMap maps a MIB identifier to an htmlEncoding index.
var mibMap = map[identifier.MIB]htmlEncoding{
	identifier.UTF8:              utf8,
	identifier.UTF16BE:           utf16be,
	identifier.UTF16LE:           utf16le,
	identifier.IBM866:            ibm866,
	identifier.ISOLatin2:         iso8859_2,
	identifier.ISOLatin3:         iso8859_3,
	identifier.ISOLatin4:         iso8859_4,
	identifier.ISOLatinCyrillic:  iso8859_5,
	identifier.ISOLatinArabic:    iso8859_6,
	identifier.ISOLatinGreek:     iso8859_7,
	identifier.ISOLatinHebrew:    iso8859_8,
	identifier.ISO88598I:         iso8859_8I,
	identifier.ISOLatin6:         iso8859_10,
	identifier.ISO885913:         iso8859_13,
	identifier.ISO885914:         iso8859_14,
	identifier.ISO885915:         iso8859_15,
	identifier.ISO885916:         iso8859_16,
	identifier.KOI8R:             koi8r,
	identifier.KOI8U:             koi8u,
	identifier.Macintosh:         macintosh,
	identifier.MacintoshCyrillic: macintoshCyrillic,
	identifier.Windows874:        windows874,
	identifier.Windows1250:       windows1250,
	identifier.Windows1251:       windows1251,
	identifier.Windows1252:       windows1252,
	identifier.Windows1253:       windows1253,
	identifier.Windows1254:       windows1254,
	identifier.Windows1255:       windows1255,
	identifier.Windows1256:       windows1256,
	identifier.Windows1257:       windows1257,
	identifier.Windows1258:       windows1258,
	identifier.XUserDefined:      xUserDefined,
	identifier.GBK:               gbk,
	identifier.GB18030:           gb18030,
	identifier.Big5:              big5,
	identifier.EUCPkdFmtJapanese: eucjp,
	identifier.ISO2022JP:         iso2022jp,
	identifier.ShiftJIS:          shiftJIS,
	identifier.EUCKR:             euckr,
	identifier.Replacement:       replacement,
}

// encodings maps the internal htmlEncoding to an Encoding.
// TODO: consider using a reusable index in encoding/internal.
var encodings = [numEncodings]encoding.Encoding{
	utf8:              unicode.UTF8,
	ibm866:            charmap.CodePage866,
	iso8859_2:         charmap.ISO8859_2,
	iso8859_3:         charmap.ISO8859_3,
	iso8859_4:         charmap.ISO8859_4,
	iso8859_5:         charmap.ISO8859_5,
	iso8859_6:         charmap.ISO8859_6,
	iso8859_7:         charmap.ISO8859_7,
	iso8859_8:         charmap.ISO8859_8,
	iso8859_8I:        charmap.ISO8859_8I,
	iso8859_10:        charmap.ISO8859_10,
	iso8859_13:        charmap.ISO8859_13,
	iso8859_14:        charmap.ISO8859_14,
	iso8859_15:        charmap.ISO8859_15,
	iso8859_16:        charmap.ISO8859_16,
	koi8r:             charmap.KOI8R,
	koi8u:             charmap.KOI8U,
	macintosh:         charmap.Macintosh,
	windows874:        charmap.Windows874,
	windows1250:       charmap.Windows1250,
	windows1251:       charmap.Windows1251,
	windows1252:       charmap.Windows1252,
	windows1253:       charmap.Windows1253,
	windows1254:       charmap.Windows1254,
	windows1255:       charmap.Windows1255,
	windows1256:       charmap.Windows1256,
	windows1257:       charmap.Windows1257,
	windows1258:       charmap.Windows1258,
	macintoshCyrillic: charmap.MacintoshCyrillic,
	gbk:               simplifiedchinese.GBK,
	gb18030:           simplifiedchinese.GB18030,
	big5:              traditionalchinese.Big5,
	eucjp:             japanese.EUCJP,
	iso2022jp:         japanese.ISO2022JP,
	shiftJIS:          japanese.ShiftJIS,
	euckr:             korean.EUCKR,
	replacement:       encoding.Replacement,
	utf16be:           unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM),
	utf16le:           unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM),
	xUserDefined:      charmap.XUserDefined,
}