MBCSSM.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is Mozilla Universal charset detector code.
  15. *
  16. * The Initial Developer of the Original Code is
  17. * Netscape Communications Corporation.
  18. * Portions created by the Initial Developer are Copyright (C) 2001
  19. * the Initial Developer. All Rights Reserved.
  20. *
  21. * Contributor(s):
  22. * Shy Shalom <shooshX@gmail.com>
  23. * Rudi Pettazzi <rudi.pettazzi@gmail.com> (C# port)
  24. *
  25. * Alternatively, the contents of this file may be used under the terms of
  26. * either the GNU General Public License Version 2 or later (the "GPL"), or
  27. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. * in which case the provisions of the GPL or the LGPL are applicable instead
  29. * of those above. If you wish to allow use of your version of this file only
  30. * under the terms of either the GPL or the LGPL, and not to allow others to
  31. * use your version of this file under the terms of the MPL, indicate your
  32. * decision by deleting the provisions above and replace them with the notice
  33. * and other provisions required by the GPL or the LGPL. If you do not delete
  34. * the provisions above, a recipient may use your version of this file under
  35. * the terms of any one of the MPL, the GPL or the LGPL.
  36. *
  37. * ***** END LICENSE BLOCK ***** */
  38. namespace UniversalDetector.Core
  39. {
  40. public class UTF8SMModel : SMModel
  41. {
  42. private readonly static int[] UTF8_cls = {
  43. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
  44. BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
  45. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
  46. BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
  47. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
  48. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
  49. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
  50. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
  51. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 40 - 47
  52. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 48 - 4f
  53. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 50 - 57
  54. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 58 - 5f
  55. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 60 - 67
  56. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 68 - 6f
  57. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 70 - 77
  58. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 78 - 7f
  59. BitPackage.Pack4bits(2,2,2,2,3,3,3,3), // 80 - 87
  60. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 88 - 8f
  61. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 90 - 97
  62. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 98 - 9f
  63. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // a0 - a7
  64. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // a8 - af
  65. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // b0 - b7
  66. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // b8 - bf
  67. BitPackage.Pack4bits(0,0,6,6,6,6,6,6), // c0 - c7
  68. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c8 - cf
  69. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d0 - d7
  70. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d8 - df
  71. BitPackage.Pack4bits(7,8,8,8,8,8,8,8), // e0 - e7
  72. BitPackage.Pack4bits(8,8,8,8,8,9,8,8), // e8 - ef
  73. BitPackage.Pack4bits(10,11,11,11,11,11,11,11), // f0 - f7
  74. BitPackage.Pack4bits(12,13,13,13,14,15,0,0) // f8 - ff
  75. };
  76. private readonly static int[] UTF8_st = {
  77. BitPackage.Pack4bits(ERROR,START,ERROR,ERROR,ERROR,ERROR, 12, 10),//00-07
  78. BitPackage.Pack4bits( 9, 11, 8, 7, 6, 5, 4, 3),//08-0f
  79. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//10-17
  80. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//18-1f
  81. BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//20-27
  82. BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME,ITSME),//28-2f
  83. BitPackage.Pack4bits(ERROR,ERROR, 5, 5, 5, 5,ERROR,ERROR),//30-37
  84. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//38-3f
  85. BitPackage.Pack4bits(ERROR,ERROR,ERROR, 5, 5, 5,ERROR,ERROR),//40-47
  86. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//48-4f
  87. BitPackage.Pack4bits(ERROR,ERROR, 7, 7, 7, 7,ERROR,ERROR),//50-57
  88. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//58-5f
  89. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR, 7, 7,ERROR,ERROR),//60-67
  90. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//68-6f
  91. BitPackage.Pack4bits(ERROR,ERROR, 9, 9, 9, 9,ERROR,ERROR),//70-77
  92. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//78-7f
  93. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR, 9,ERROR,ERROR),//80-87
  94. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//88-8f
  95. BitPackage.Pack4bits(ERROR,ERROR, 12, 12, 12, 12,ERROR,ERROR),//90-97
  96. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//98-9f
  97. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR, 12,ERROR,ERROR),//a0-a7
  98. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//a8-af
  99. BitPackage.Pack4bits(ERROR,ERROR, 12, 12, 12,ERROR,ERROR,ERROR),//b0-b7
  100. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR),//b8-bf
  101. BitPackage.Pack4bits(ERROR,ERROR,START,START,START,START,ERROR,ERROR),//c0-c7
  102. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ERROR) //c8-cf
  103. };
  104. private readonly static int[] UTF8CharLenTable =
  105. {0, 1, 0, 0, 0, 0, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6 };
  106. public UTF8SMModel() : base(
  107. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  108. BitPackage.SHIFT_MASK_4BITS,
  109. BitPackage.BIT_SHIFT_4BITS,
  110. BitPackage.UNIT_MASK_4BITS, UTF8_cls),
  111. 16,
  112. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  113. BitPackage.SHIFT_MASK_4BITS,
  114. BitPackage.BIT_SHIFT_4BITS,
  115. BitPackage.UNIT_MASK_4BITS, UTF8_st),
  116. UTF8CharLenTable, "UTF-8")
  117. {
  118. }
  119. }
  120. public class GB18030SMModel : SMModel
  121. {
  122. private readonly static int[] GB18030_cls = {
  123. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
  124. BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
  125. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
  126. BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
  127. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
  128. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
  129. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 30 - 37
  130. BitPackage.Pack4bits(3,3,1,1,1,1,1,1), // 38 - 3f
  131. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
  132. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
  133. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
  134. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
  135. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
  136. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
  137. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
  138. BitPackage.Pack4bits(2,2,2,2,2,2,2,4), // 78 - 7f
  139. BitPackage.Pack4bits(5,6,6,6,6,6,6,6), // 80 - 87
  140. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 88 - 8f
  141. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 90 - 97
  142. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // 98 - 9f
  143. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // a0 - a7
  144. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // a8 - af
  145. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // b0 - b7
  146. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // b8 - bf
  147. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c0 - c7
  148. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // c8 - cf
  149. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d0 - d7
  150. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // d8 - df
  151. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // e0 - e7
  152. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // e8 - ef
  153. BitPackage.Pack4bits(6,6,6,6,6,6,6,6), // f0 - f7
  154. BitPackage.Pack4bits(6,6,6,6,6,6,6,0) // f8 - ff
  155. };
  156. private readonly static int[] GB18030_st = {
  157. BitPackage.Pack4bits(ERROR,START,START,START,START,START, 3,ERROR),//00-07
  158. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//08-0f
  159. BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ERROR,ERROR,START),//10-17
  160. BitPackage.Pack4bits( 4,ERROR,START,START,ERROR,ERROR,ERROR,ERROR),//18-1f
  161. BitPackage.Pack4bits(ERROR,ERROR, 5,ERROR,ERROR,ERROR,ITSME,ERROR),//20-27
  162. BitPackage.Pack4bits(ERROR,ERROR,START,START,START,START,START,START) //28-2f
  163. };
  164. // To be accurate, the length of class 6 can be either 2 or 4.
  165. // But it is not necessary to discriminate between the two since
  166. // it is used for frequency analysis only, and we are validating
  167. // each code range there as well. So it is safe to set it to be
  168. // 2 here.
  169. private readonly static int[] GB18030CharLenTable = {0, 1, 1, 1, 1, 1, 2};
  170. public GB18030SMModel() : base(
  171. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  172. BitPackage.SHIFT_MASK_4BITS,
  173. BitPackage.BIT_SHIFT_4BITS,
  174. BitPackage.UNIT_MASK_4BITS, GB18030_cls),
  175. 7,
  176. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  177. BitPackage.SHIFT_MASK_4BITS,
  178. BitPackage.BIT_SHIFT_4BITS,
  179. BitPackage.UNIT_MASK_4BITS, GB18030_st),
  180. GB18030CharLenTable, "GB18030")
  181. {
  182. }
  183. }
  184. public class BIG5SMModel : SMModel
  185. {
  186. private readonly static int[] BIG5_cls = {
  187. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
  188. BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
  189. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
  190. BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
  191. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
  192. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
  193. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
  194. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
  195. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
  196. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
  197. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
  198. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
  199. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
  200. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
  201. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
  202. BitPackage.Pack4bits(2,2,2,2,2,2,2,1), // 78 - 7f
  203. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 80 - 87
  204. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 88 - 8f
  205. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 90 - 97
  206. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 98 - 9f
  207. BitPackage.Pack4bits(4,3,3,3,3,3,3,3), // a0 - a7
  208. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // a8 - af
  209. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // b0 - b7
  210. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // b8 - bf
  211. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c0 - c7
  212. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c8 - cf
  213. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d0 - d7
  214. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d8 - df
  215. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
  216. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e8 - ef
  217. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // f0 - f7
  218. BitPackage.Pack4bits(3,3,3,3,3,3,3,0) // f8 - ff
  219. };
  220. private readonly static int[] BIG5_st = {
  221. BitPackage.Pack4bits(ERROR,START,START, 3,ERROR,ERROR,ERROR,ERROR),//00-07
  222. BitPackage.Pack4bits(ERROR,ERROR,ITSME,ITSME,ITSME,ITSME,ITSME,ERROR),//08-0f
  223. BitPackage.Pack4bits(ERROR,START,START,START,START,START,START,START) //10-17
  224. };
  225. private readonly static int[] BIG5CharLenTable = {0, 1, 1, 2, 0};
  226. public BIG5SMModel() : base(
  227. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  228. BitPackage.SHIFT_MASK_4BITS,
  229. BitPackage.BIT_SHIFT_4BITS,
  230. BitPackage.UNIT_MASK_4BITS, BIG5_cls),
  231. 5,
  232. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  233. BitPackage.SHIFT_MASK_4BITS,
  234. BitPackage.BIT_SHIFT_4BITS,
  235. BitPackage.UNIT_MASK_4BITS, BIG5_st),
  236. BIG5CharLenTable, "Big5")
  237. {
  238. }
  239. }
  240. public class EUCJPSMModel : SMModel
  241. {
  242. private readonly static int[] EUCJP_cls = {
  243. //BitPacket.Pack4bits(5,4,4,4,4,4,4,4), // 00 - 07
  244. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 00 - 07
  245. BitPackage.Pack4bits(4,4,4,4,4,4,5,5), // 08 - 0f
  246. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 10 - 17
  247. BitPackage.Pack4bits(4,4,4,5,4,4,4,4), // 18 - 1f
  248. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 20 - 27
  249. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 28 - 2f
  250. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 30 - 37
  251. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 38 - 3f
  252. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 40 - 47
  253. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 48 - 4f
  254. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 50 - 57
  255. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 58 - 5f
  256. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 60 - 67
  257. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 68 - 6f
  258. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 70 - 77
  259. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // 78 - 7f
  260. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 80 - 87
  261. BitPackage.Pack4bits(5,5,5,5,5,5,1,3), // 88 - 8f
  262. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 90 - 97
  263. BitPackage.Pack4bits(5,5,5,5,5,5,5,5), // 98 - 9f
  264. BitPackage.Pack4bits(5,2,2,2,2,2,2,2), // a0 - a7
  265. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
  266. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
  267. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
  268. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
  269. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
  270. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
  271. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
  272. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
  273. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
  274. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
  275. BitPackage.Pack4bits(0,0,0,0,0,0,0,5) // f8 - ff
  276. };
  277. private readonly static int[] EUCJP_st = {
  278. BitPackage.Pack4bits( 3, 4, 3, 5,START,ERROR,ERROR,ERROR),//00-07
  279. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
  280. BitPackage.Pack4bits(ITSME,ITSME,START,ERROR,START,ERROR,ERROR,ERROR),//10-17
  281. BitPackage.Pack4bits(ERROR,ERROR,START,ERROR,ERROR,ERROR, 3,ERROR),//18-1f
  282. BitPackage.Pack4bits( 3,ERROR,ERROR,ERROR,START,START,START,START) //20-27
  283. };
  284. private readonly static int[] EUCJPCharLenTable = { 2, 2, 2, 3, 1, 0 };
  285. public EUCJPSMModel() : base(
  286. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  287. BitPackage.SHIFT_MASK_4BITS,
  288. BitPackage.BIT_SHIFT_4BITS,
  289. BitPackage.UNIT_MASK_4BITS, EUCJP_cls),
  290. 6,
  291. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  292. BitPackage.SHIFT_MASK_4BITS,
  293. BitPackage.BIT_SHIFT_4BITS,
  294. BitPackage.UNIT_MASK_4BITS, EUCJP_st),
  295. EUCJPCharLenTable, "EUC-JP")
  296. {
  297. }
  298. }
  299. public class EUCKRSMModel : SMModel
  300. {
  301. private readonly static int[] EUCKR_cls = {
  302. //BitPacket.Pack4bits(0,1,1,1,1,1,1,1), // 00 - 07
  303. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
  304. BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
  305. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
  306. BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
  307. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
  308. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
  309. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
  310. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
  311. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 40 - 47
  312. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 48 - 4f
  313. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 50 - 57
  314. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 58 - 5f
  315. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 60 - 67
  316. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 68 - 6f
  317. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 70 - 77
  318. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 78 - 7f
  319. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
  320. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
  321. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
  322. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
  323. BitPackage.Pack4bits(0,2,2,2,2,2,2,2), // a0 - a7
  324. BitPackage.Pack4bits(2,2,2,2,2,3,3,3), // a8 - af
  325. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
  326. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
  327. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
  328. BitPackage.Pack4bits(2,3,2,2,2,2,2,2), // c8 - cf
  329. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
  330. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
  331. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e0 - e7
  332. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // e8 - ef
  333. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // f0 - f7
  334. BitPackage.Pack4bits(2,2,2,2,2,2,2,0) // f8 - ff
  335. };
  336. private readonly static int[] EUCKR_st = {
  337. BitPackage.Pack4bits(ERROR,START, 3,ERROR,ERROR,ERROR,ERROR,ERROR),//00-07
  338. BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ERROR,ERROR,START,START) //08-0f
  339. };
  340. private readonly static int[] EUCKRCharLenTable = { 0, 1, 2, 0 };
  341. public EUCKRSMModel() : base(
  342. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  343. BitPackage.SHIFT_MASK_4BITS,
  344. BitPackage.BIT_SHIFT_4BITS,
  345. BitPackage.UNIT_MASK_4BITS, EUCKR_cls),
  346. 4,
  347. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  348. BitPackage.SHIFT_MASK_4BITS,
  349. BitPackage.BIT_SHIFT_4BITS,
  350. BitPackage.UNIT_MASK_4BITS, EUCKR_st),
  351. EUCKRCharLenTable, "EUC-KR")
  352. {
  353. }
  354. }
  355. public class EUCTWSMModel : SMModel
  356. {
  357. private readonly static int[] EUCTW_cls = {
  358. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 00 - 07
  359. BitPackage.Pack4bits(2,2,2,2,2,2,0,0), // 08 - 0f
  360. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 10 - 17
  361. BitPackage.Pack4bits(2,2,2,0,2,2,2,2), // 18 - 1f
  362. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 20 - 27
  363. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 28 - 2f
  364. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 30 - 37
  365. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 38 - 3f
  366. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
  367. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
  368. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
  369. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
  370. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
  371. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
  372. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
  373. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 78 - 7f
  374. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
  375. BitPackage.Pack4bits(0,0,0,0,0,0,6,0), // 88 - 8f
  376. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
  377. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
  378. BitPackage.Pack4bits(0,3,4,4,4,4,4,4), // a0 - a7
  379. BitPackage.Pack4bits(5,5,1,1,1,1,1,1), // a8 - af
  380. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b0 - b7
  381. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // b8 - bf
  382. BitPackage.Pack4bits(1,1,3,1,3,3,3,3), // c0 - c7
  383. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // c8 - cf
  384. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d0 - d7
  385. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // d8 - df
  386. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
  387. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e8 - ef
  388. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // f0 - f7
  389. BitPackage.Pack4bits(3,3,3,3,3,3,3,0) // f8 - ff
  390. };
  391. private readonly static int[] EUCTW_st = {
  392. BitPackage.Pack4bits(ERROR,ERROR,START, 3, 3, 3, 4,ERROR),//00-07
  393. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ERROR,ERROR,ITSME,ITSME),//08-0f
  394. BitPackage.Pack4bits(ITSME,ITSME,ITSME,ITSME,ITSME,ERROR,START,ERROR),//10-17
  395. BitPackage.Pack4bits(START,START,START,ERROR,ERROR,ERROR,ERROR,ERROR),//18-1f
  396. BitPackage.Pack4bits( 5,ERROR,ERROR,ERROR,START,ERROR,START,START),//20-27
  397. BitPackage.Pack4bits(START,ERROR,START,START,START,START,START,START) //28-2f
  398. };
  399. private readonly static int[] EUCTWCharLenTable = { 0, 0, 1, 2, 2, 2, 3 };
  400. public EUCTWSMModel() : base(
  401. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  402. BitPackage.SHIFT_MASK_4BITS,
  403. BitPackage.BIT_SHIFT_4BITS,
  404. BitPackage.UNIT_MASK_4BITS, EUCTW_cls),
  405. 7,
  406. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  407. BitPackage.SHIFT_MASK_4BITS,
  408. BitPackage.BIT_SHIFT_4BITS,
  409. BitPackage.UNIT_MASK_4BITS, EUCTW_st),
  410. EUCTWCharLenTable, "EUC-TW")
  411. {
  412. }
  413. }
  414. public class SJISSMModel : SMModel
  415. {
  416. private readonly static int[] SJIS_cls = {
  417. //BitPacket.Pack4bits(0,1,1,1,1,1,1,1), // 00 - 07
  418. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 00 - 07
  419. BitPackage.Pack4bits(1,1,1,1,1,1,0,0), // 08 - 0f
  420. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 10 - 17
  421. BitPackage.Pack4bits(1,1,1,0,1,1,1,1), // 18 - 1f
  422. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 20 - 27
  423. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 28 - 2f
  424. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 30 - 37
  425. BitPackage.Pack4bits(1,1,1,1,1,1,1,1), // 38 - 3f
  426. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 40 - 47
  427. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 48 - 4f
  428. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 50 - 57
  429. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 58 - 5f
  430. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 60 - 67
  431. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 68 - 6f
  432. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // 70 - 77
  433. BitPackage.Pack4bits(2,2,2,2,2,2,2,1), // 78 - 7f
  434. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 80 - 87
  435. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 88 - 8f
  436. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 90 - 97
  437. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // 98 - 9f
  438. //0xa0 is illegal in sjis encoding, but some pages does
  439. //contain such byte. We need to be more error forgiven.
  440. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a0 - a7
  441. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // a8 - af
  442. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b0 - b7
  443. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // b8 - bf
  444. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c0 - c7
  445. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // c8 - cf
  446. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d0 - d7
  447. BitPackage.Pack4bits(2,2,2,2,2,2,2,2), // d8 - df
  448. BitPackage.Pack4bits(3,3,3,3,3,3,3,3), // e0 - e7
  449. BitPackage.Pack4bits(3,3,3,3,3,4,4,4), // e8 - ef
  450. BitPackage.Pack4bits(4,4,4,4,4,4,4,4), // f0 - f7
  451. BitPackage.Pack4bits(4,4,4,4,4,0,0,0) // f8 - ff
  452. };
  453. private readonly static int[] SJIS_st = {
  454. BitPackage.Pack4bits(ERROR,START,START, 3,ERROR,ERROR,ERROR,ERROR),//00-07
  455. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
  456. BitPackage.Pack4bits(ITSME,ITSME,ERROR,ERROR,START,START,START,START) //10-17
  457. };
  458. private readonly static int[] SJISCharLenTable = { 0, 1, 1, 2, 0, 0 };
  459. public SJISSMModel() : base(
  460. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  461. BitPackage.SHIFT_MASK_4BITS,
  462. BitPackage.BIT_SHIFT_4BITS,
  463. BitPackage.UNIT_MASK_4BITS, SJIS_cls),
  464. 6,
  465. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  466. BitPackage.SHIFT_MASK_4BITS,
  467. BitPackage.BIT_SHIFT_4BITS,
  468. BitPackage.UNIT_MASK_4BITS, SJIS_st),
  469. SJISCharLenTable, "Shift_JIS")
  470. {
  471. }
  472. }
  473. public class UCS2BESMModel : SMModel
  474. {
  475. private readonly static int[] UCS2BE_cls = {
  476. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 00 - 07
  477. BitPackage.Pack4bits(0,0,1,0,0,2,0,0), // 08 - 0f
  478. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
  479. BitPackage.Pack4bits(0,0,0,3,0,0,0,0), // 18 - 1f
  480. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
  481. BitPackage.Pack4bits(0,3,3,3,3,3,0,0), // 28 - 2f
  482. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
  483. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
  484. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
  485. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
  486. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
  487. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
  488. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
  489. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
  490. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
  491. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
  492. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
  493. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
  494. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
  495. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
  496. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a0 - a7
  497. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a8 - af
  498. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b0 - b7
  499. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b8 - bf
  500. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c0 - c7
  501. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c8 - cf
  502. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d0 - d7
  503. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d8 - df
  504. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
  505. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
  506. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
  507. BitPackage.Pack4bits(0,0,0,0,0,0,4,5) // f8 - ff
  508. };
  509. private readonly static int[] UCS2BE_st = {
  510. BitPackage.Pack4bits( 5, 7, 7,ERROR, 4, 3,ERROR,ERROR),//00-07
  511. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
  512. BitPackage.Pack4bits(ITSME,ITSME, 6, 6, 6, 6,ERROR,ERROR),//10-17
  513. BitPackage.Pack4bits( 6, 6, 6, 6, 6,ITSME, 6, 6),//18-1f
  514. BitPackage.Pack4bits( 6, 6, 6, 6, 5, 7, 7,ERROR),//20-27
  515. BitPackage.Pack4bits( 5, 8, 6, 6,ERROR, 6, 6, 6),//28-2f
  516. BitPackage.Pack4bits( 6, 6, 6, 6,ERROR,ERROR,START,START) //30-37
  517. };
  518. private readonly static int[] UCS2BECharLenTable = { 2, 2, 2, 0, 2, 2 };
  519. public UCS2BESMModel() : base(
  520. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  521. BitPackage.SHIFT_MASK_4BITS,
  522. BitPackage.BIT_SHIFT_4BITS,
  523. BitPackage.UNIT_MASK_4BITS, UCS2BE_cls),
  524. 6,
  525. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  526. BitPackage.SHIFT_MASK_4BITS,
  527. BitPackage.BIT_SHIFT_4BITS,
  528. BitPackage.UNIT_MASK_4BITS, UCS2BE_st),
  529. UCS2BECharLenTable, "UTF-16BE")
  530. {
  531. }
  532. }
  533. public class UCS2LESMModel : SMModel
  534. {
  535. private readonly static int[] UCS2LE_cls = {
  536. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 00 - 07
  537. BitPackage.Pack4bits(0,0,1,0,0,2,0,0), // 08 - 0f
  538. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 10 - 17
  539. BitPackage.Pack4bits(0,0,0,3,0,0,0,0), // 18 - 1f
  540. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 20 - 27
  541. BitPackage.Pack4bits(0,3,3,3,3,3,0,0), // 28 - 2f
  542. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 30 - 37
  543. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 38 - 3f
  544. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 40 - 47
  545. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 48 - 4f
  546. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 50 - 57
  547. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 58 - 5f
  548. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 60 - 67
  549. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 68 - 6f
  550. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 70 - 77
  551. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 78 - 7f
  552. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 80 - 87
  553. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 88 - 8f
  554. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 90 - 97
  555. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // 98 - 9f
  556. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a0 - a7
  557. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // a8 - af
  558. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b0 - b7
  559. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // b8 - bf
  560. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c0 - c7
  561. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // c8 - cf
  562. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d0 - d7
  563. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // d8 - df
  564. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e0 - e7
  565. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // e8 - ef
  566. BitPackage.Pack4bits(0,0,0,0,0,0,0,0), // f0 - f7
  567. BitPackage.Pack4bits(0,0,0,0,0,0,4,5) // f8 - ff
  568. };
  569. private readonly static int[] UCS2LE_st = {
  570. BitPackage.Pack4bits( 6, 6, 7, 6, 4, 3,ERROR,ERROR),//00-07
  571. BitPackage.Pack4bits(ERROR,ERROR,ERROR,ERROR,ITSME,ITSME,ITSME,ITSME),//08-0f
  572. BitPackage.Pack4bits(ITSME,ITSME, 5, 5, 5,ERROR,ITSME,ERROR),//10-17
  573. BitPackage.Pack4bits( 5, 5, 5,ERROR, 5,ERROR, 6, 6),//18-1f
  574. BitPackage.Pack4bits( 7, 6, 8, 8, 5, 5, 5,ERROR),//20-27
  575. BitPackage.Pack4bits( 5, 5, 5,ERROR,ERROR,ERROR, 5, 5),//28-2f
  576. BitPackage.Pack4bits( 5, 5, 5,ERROR, 5,ERROR,START,START) //30-37
  577. };
  578. private readonly static int[] UCS2LECharLenTable = { 2, 2, 2, 2, 2, 2 };
  579. public UCS2LESMModel() : base(
  580. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  581. BitPackage.SHIFT_MASK_4BITS,
  582. BitPackage.BIT_SHIFT_4BITS,
  583. BitPackage.UNIT_MASK_4BITS, UCS2LE_cls),
  584. 6,
  585. new BitPackage(BitPackage.INDEX_SHIFT_4BITS,
  586. BitPackage.SHIFT_MASK_4BITS,
  587. BitPackage.BIT_SHIFT_4BITS,
  588. BitPackage.UNIT_MASK_4BITS, UCS2LE_st),
  589. UCS2LECharLenTable, "UTF-16LE")
  590. {
  591. }
  592. }
  593. }