Intial Commit
This commit is contained in:
commit
664c6d8ca3
5892 files changed
+759183
No files matched your search
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
Modifications for better node.js integration:
|
||||
Copyright 2013 Brian White. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
Copyright 2012 Joshua Bell
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
module.exports = {
|
||||
"big5":[null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 17392, 19506, 17923, 17830, 17784, 160359, 19831, 17843, 162993, 19682, 163013, 15253, 18230, 18244, 19527, 19520, 148159, 144919, 160594, 159371, 159954, 19543, 172881, 18255, 17882, 19589, 162924, 19719, 19108, 18081, 158499, 29221, 154196, 137827, 146950, 147297, 26189, 22267, null, 32149, 22813, 166841, 15860, 38708, 162799, 23515, 138590, 23204, 13861, 171696, 23249, 23479, 23804, 26478, 34195, 170309, 29793, 29853, 14453, 138579, 145054, 155681, 16108, 153822, 15093, 31484, 40855, 147809, 166157, 143850, 133770, 143966, 17162, 33924, 40854, 37935, 18736, 34323, 22678, 38730, 37400, 31184, 31282, 26208, 27177, 34973, 29772, 31685, 26498, 31276, 21071, 36934, 13542, 29636, 155065, 29894, 40903, 22451, 18735, 21580, 16689, 145038, 22552, 31346, 162661, 35727, 18094, 159368, 16769, 155033, 31662, 140476, 40904, 140481, 140489, 140492, 40905, 34052, 144827, 16564, 40906, 17633, 175615, 25281, 28782, 40907, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12736, 12737, 12738, 12739, 12740, 131340, 12741, 131281, 131277, 12742, 12743, 131275, 139240, 12744, 131274, 12745, 12746, 12747, 12748, 131342, 12749, 12750, 256, 193, 461, 192, 274, 201, 282, 200, 332, 211, 465, 210, null, 7870, null, 7872, 202, 257, 225, 462, 224, 593, 275, 233, 283, 232, 299, 237, 464, 236, 333, 243, 466, 242, 363, 250, 468, 249, 470, 472, 474, 476, 252, null, 7871, null, 7873, 234, 609, 9178, 9179, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 172969, 135493, null, 25866, null, null, 20029, 28381, 40270, 37343, null, null, 161589, 25745, 20250, 20264, 20392, 20822, 20852, 20892, 20964, 21153, 21160, 21307, 21326, 21457, 21464, 22242, 22768, 22788, 22791, 22834, 22836, 23398, 23454, 23455, 23706, 24198, 24635, 25993, 26622, 26628, 26725, 27982, 28860, 30005, 32420, 32428, 32442, 32455, 32463, 32479, 32518, 32567, 33402, 33487, 33647, 35270, 35774, 35810, 36710, 36711, 36718, 29713, 31996, 32205, 26950, 31433, 21031, null, null, null, null, 37260, 30904, 37214, 32956, null, 36107, 33014, 133607, null, null, 32927, 40647, 19661, 40393, 40460, 19518, 171510, 159758, 40458, 172339, 13761, null, 28314, 33342, 29977, null, 18705, 39532, 39567, 40857, 31111, 164972, 138698, 132560, 142054, 20004, 20097, 20096, 20103, 20159, 20203, 20279, 13388, 20413, 15944, 20483, 20616, 13437, 13459, 13477, 20870, 22789, 20955, 20988, 20997, 20105, 21113, 21136, 21287, 13767, 21417, 13649, 21424, 13651, 21442, 21539, 13677, 13682, 13953, 21651, 21667, 21684, 21689, 21712, 21743, 21784, 21795, 21800, 13720, 21823, 13733, 13759, 21975, 13765, 163204, 21797, null, 134210, 134421, 151851, 21904, 142534, 14828, 131905, 36422, 150968, 169189, 16467, 164030, 30586, 142392, 14900, 18389, 164189, 158194, 151018, 25821, 134524, 135092, 134357, 135412, 25741, 36478, 134806, 134155, 135012, 142505, 164438, 148691, null, 134470, 170573, 164073, 18420, 151207, 142530, 39602, 14951, 169460, 16365, 13574, 152263, 169940, 161992, 142660, 40302, 38933, null, 17369, 155813, 25780, 21731, 142668, 142282, 135287, 14843, 135279, 157402, 157462, 162208, 25834, 151634, 134211, 36456, 139681, 166732, 132913, null, 18443, 131497, 16378, 22643, 142733, null, 148936, 132348, 155799, 134988, 134550, 21881, 16571, 17338, null, 19124, 141926, 135325, 33194, 39157, 134556, 25465, 14846, 141173, 36288, 22177, 25724, 15939, null, 173569, 134665, 142031, 142537, null, 135368, 145858, 14738, 14854, 164507, 13688, 155209, 139463, 22098, 134961, 142514, 169760, 13500, 27709, 151099, null, null, 161140, 142987, 139784, 173659, 167117, 134778, 134196, 157724, 32659, 135375, 141315, 141625, 13819, 152035, 134796, 135053, 134826, 16275, 134960, 134471, 135503, 134732, null, 134827, 134057, 134472, 135360, 135485, 16377, 140950, 25650, 135085, 144372, 161337, 1422Line truncated
|
||||
"euc-kr":[44034,44035,44037,44038,44043,44044,44045,44046,44047,44056,44062,44063,44065,44066,44067,44069,44070,44071,44072,44073,44074,44075,44078,44082,44083,44084,44085,44086,44087,44090,44091,44093,44094,44095,44097,44098,44099,44100,44101,44102,44103,44104,44105,44106,44108,44110,44111,44112,44113,44114,44115,44117,44118,44119,44121,44122,44123,44125,44126,44127,44128,44129,44130,44131,44132,44133,44134,44135,44136,44137,44138,44139,44140,44141,44142,44143,44146,44147,44149,44150,44153,44155,44156,44157,44158,44159,44162,44167,44168,44173,44174,44175,44177,44178,44179,44181,44182,44183,44184,44185,44186,44187,44190,44194,44195,44196,44197,44198,44199,44203,44205,44206,44209,44210,44211,44212,44213,44214,44215,44218,44222,44223,44224,44226,44227,44229,44230,44231,44233,44234,44235,44237,44238,44239,44240,44241,44242,44243,44244,44246,44248,44249,44250,44251,44252,44253,44254,44255,44258,44259,44261,44262,44265,44267,44269,44270,44274,44276,44279,44280,44281,44282,44283,44286,44287,44289,44290,44291,44293,44295,44296,44297,44298,44299,44302,44304,44306,44307,44308,44309,44310,44311,44313,44314,44315,44317,44318,44319,44321,44322,44323,44324,44325,44326,44327,44328,44330,44331,44334,44335,44336,44337,44338,44339,44342,44343,44345,44346,44347,44349,44350,44351,44352,44353,44354,44355,44358,44360,44362,44363,44364,44365,44366,44367,44369,44370,44371,44373,44374,44375,44377,44378,44379,44380,44381,44382,44383,44384,44386,44388,44389,44390,44391,44392,44393,44394,44395,44398,44399,44401,44402,44407,44408,44409,44410,44414,44416,44419,44420,44421,44422,44423,44426,44427,44429,44430,44431,44433,44434,44435,44436,44437,44438,44439,44440,44441,44442,44443,44446,44447,44448,44449,44450,44451,44453,44454,44455,44456,44457,44458,44459,44460,44461,44462,44463,44464,44465,44466,44467,44468,44469,44470,44472,44473,44474,44475,44476,44477,44478,44479,44482,44483,44485,44486,44487,44489,44490,44491,44492,44493,44494,44495,44498,44500,44501,44502,44503,44504,44505,44506,44507,44509,44510,44511,44513,44514,44515,44517,44518,44519,44520,44521,44522,44523,44524,44525,44526,44527,44528,44529,44530,44531,44532,44533,44534,44535,44538,44539,44541,44542,44546,44547,44548,44549,44550,44551,44554,44556,44558,44559,44560,44561,44562,44563,44565,44566,44567,44568,44569,44570,44571,44572,44573,44574,44575,44576,44577,44578,44579,44580,44581,44582,44583,44584,44585,44586,44587,44588,44589,44590,44591,44594,44595,44597,44598,44601,44603,44604,44605,44606,44607,44610,44612,44615,44616,44617,44619,44623,44625,44626,44627,44629,44631,44632,44633,44634,44635,44638,44642,44643,44644,44646,44647,44650,44651,44653,44654,44655,44657,44658,44659,44660,44661,44662,44663,44666,44670,44671,44672,44673,44674,44675,44678,44679,44680,44681,44682,44683,44685,44686,44687,44688,44689,44690,44691,44692,44693,44694,44695,44696,44697,44698,44699,44700,44701,44702,44703,44704,44705,44706,44707,44708,44709,44710,44711,44712,44713,44714,44715,44716,44717,44718,44719,44720,44721,44722,44723,44724,44725,44726,44727,44728,44729,44730,44731,44735,44737,44738,44739,44741,44742,44743,44744,44745,44746,44747,44750,44754,44755,44756,44757,44758,44759,44762,44763,44765,44766,44767,44768,44769,44770,44771,44772,44773,44774,44775,44777,44778,44780,44782,44783,44784,44785,44786,44787,44789,44790,44791,44793,44794,44795,44797,44798,44799,44800,44801,44802,44803,44804,44805,44806,44809,44810,44811,44812,44814,44815,44817,44818,44819,44820,44821,44822,44823,44824,44825,44826,44827,44828,44829,44830,44831,44832,44833,44834,44835,44836,44837,44838,44839,44840,44841,44842,44843,44846,44847,44849,44851,44853,44854,44855,44856,44857,44858,44859,44862,44864,44868,44869,44870,44871,44874,44875,44876,44877,44878,44879,44881,44882,44883,44884,44885,44886,44887,44888,44889,44890,44891,44894,44895,44896,44897,44898,44899,44902,44903,44904,44905,44906,44907,44908,44909,44910,44911,44912,44913,44914,44915,44916,44917,44918,44919,44920,44922,44923,44924,44925,44926,44927,44929,44930,44931,44933,44934,44935,44937,44938,44939,44940,44941,44942,44943,44946,44947,44948,44950,44951,44952,44953,44954,44955,44957,44958,44959,44960,44961,44962,44963,44964,44965,44966,44967,44968,44969,44970,44971,44972,44973,44974,44975,44976,44977,44978,44979,44980,44981,44982,44983,44986,44987,44989,44990,44991,44993,44994,44995,44996,44997,44998,45002,45004,45007,45008,45009,45010,45011,45013,45014,45015,45016,45017,45018,45019,45021,45022,45023,45024,45025,45026,45027,45028,45029,45030,45031,45034,45035,45036,45037,45038,45039,45042,45043,45045,45046,45047,45049,45050,45051,45052,45053,45054,45055,45058,45059,45061,45062,45063,45064,45065,45066,45067,45069,45070,45071,45073,45074,45075,45077,45078,45079,45080,45081,45082,45083,45086,45087,45088,45089,45090,45091,45092,45093,45094,45095,45097,45098,45099,45100,45101,45102,45103,45104,45105,45106,45107,45108,45109,45110,45111,45112,45113,45114,45115,45116,45117,45118,45119,45120,45121,45122,45123,45126,45127,45129,45131,45133,45135,45136,45137,45138,45142,45144,45146,45147,45148,45150,45151,45152,45153,45154,45155,45156,45157,45158,45159,45160,45161,45162,45163,45164,45165,45166,45167,45168,45169,45170,45171,45172,45173,45174,45175,45176,45177,45178,45179,45182,45183,45185,45186,45187,45189,45190,45191,45192,45193,45194,45195,45198,45200,45202,45203,45204,45205,45206,45207,45211,45213,45214,45219,45220,45221,45222,45223,45226,45232,45234,45238,45239,45241,45242,45243,45245,45246,45247,45248,45249,45250,45251,45254,45258,45259,45260,45261,45262,45263,45266,45267,45269,45270,45271,45273,45274,45275,45276,45277,45278,45279,45281,45282,45283,45284,45286,45287,45288,45289,45290,45291,45292,45293,45294,45295,45296,45297,45298,45299,45300,45301,45302,45303,45304,45305,45306,45307,45308,45309,45310,45311,45312,45313,45314,45315,45316,45317,45318,45319,45322,45325,45326,45327,45329,45332,45333,45334,45335,45338,45342,45343,45344,45345,45346,45350,45351,45353,45354,45355,45357,45358,45359,45360,45361,45362,45363,45366,45370,45371,45372,45373,45374,45375,45378,45379,45381,45382,45383,45385,45386,45387,45388,45389,45390,45391,45394,45395,45398,45399,45401,45402,45403,45405,45406,45407,45409,45410,45411,45412,45413,45414,45415,45416,45417,45418,45419,45420,45421,45422,45423,45424,45425,45426,45427,45428,45429,45430,45431,45434,45435,45437,45438,45439,45441,45443,45444,45445,45446,45447,45450,45452,45454,45455,45456,45457,45461,45462,45463,45465,45466,45467,45469,45470,45471,45472,45473,45474,45475,45476,45477,45478,45479,45481,45482,45483,45484,45485,45486,45487,45488,45489,45490,45491,45492,45493,45494,45495,45496,45497,45498,45499,45500,45501,45502,45503,45504,45505,45506,45507,45508,45509,45510,45511,45512,45513,45514,45515,45517,45518,45519,45521,45522,45523,45525,45526,45527,45528,45529,45530,45531,45534,45536,45537,45538,45539,45540,45541,45542,45543,45546,45547,45549,45550,45551,45553,45554,45555,45556,45557,45558,45559,45560,45562,45564,45566,45567,45568,45569,45570,45571,45574,45575,45577,45578,45581,45582,45583,45584,45585,45586,45587,45590,45592,45594,45595,45596,45597,45598,45599,45601,45602,45603,45604,45605,45606,45607,45608,45609,45610,45611,45612,45613,45614,45615,45616,45617,45618,45619,45621,45622,45623,45624,45625,45626,45627,45629,45630,45631,45632,45633,45634,45635,45636,45637,45638,45639,45640,45641,45642,45643,45644,45645,45646,45647,45648,45649,45650,45651,45652,45653,45654,45655,45657,45658,45659,45661,45662,45663,45665,45666,45667,45668,45669,45670,45671,45674,45675,45676,45677,45678,45679,45680,45681,45682,45683,45686,45687,45688,45689,45690,45691,45693,45694,45695,45696,45697,45698,45699,45702,45703,45704,45706,45707,45708,45709,45710,45711,45714,45715,45717,45718,45719,45723,45724,45725,45726,45727,45730,45732,45735,45736,45737,45739,45741,45742,45743,45745,45746,45747,45749,45750,45751,45752,45753,45754,45755,45756,45757,45758,45759,45760,45761,45762,45763,45764,45765,45766,45767,45770,45771,45773,45774,45775,45777,45779,45780,45781,45782,45783,45786,45788,45790,45791,45792,45793,45795,45799,45801,45802,45808,45809,45810,45814,45820,45821,45822,45826,45827,45829,45830,45831,45833,45834,45835,45836,45837,45838,45839,45842,45846,45847,45848,45849,45850,45851,45853,45854,45855,45856,45857,45858,45859,45860,45861,45862,45863,45864,45865,45866,45867,45868,45869,45870,45871,45872,45873,45874,45875,45876,45877,45878,45879,45880,45881,45882,45883,45884,45885,45886,45887,45888,45889,45890,45891,45892,45893,45894,45895,45896,45897,45898,45899,45900,45901,45902,45903,45904,45905,45906,45907,45911,45913,45914,45917,45920,45921,45922,45923,45926,45928,45930,45932,45933,45935,45938,45939,45941,45942,45943,45945,45946,45947,45948,45949,45950,45951,45954,45958,45959,45960,45961,45962,45963,45965,45966,45967,45969,45970,45971,45973,45974,45975,45976,45977,45978,45979,45980,45981,45982,45983,45986,45987,45988,45989,45990,45991,45993,45994,45995,45997,45998,45999,46000,46001,46002,46003,46004,46005,46006,46007,46008,46009,46010,46011,46012,46013,46014,46015,46016,46017,46018,46019,46022,46023,46025,46026,46029,46031,46033,46034,46035,46038,46040,46042,46044,46046,46047,46049,46050,46051,46053,46054,46055,46057,46058,46059,46060,46061,46062,46063,46064,46065,46066,46067,46068,46069,46070,46071,46072,46073,46074,46075,46077,46078,46079,46080,46081,46082,46083,46084,46085,46086,46087,46088,46089,46090,46091,46092,46093,46094,46095,46097,46098,46099,46100,46101,46102,46103,46105,46106,46107,46109,46110,46111,46113,46114,46115,46116,46117,46118,46119,46122,46124,46125,46126,46127,46128,46129,46130,46131,46133,46134,46135,46136,46137,46138,46139,46140,46141,46142,46143,46144,46145,46146,46147,46148,46149,46150,46151,46152,46153,46154,46155,46156,46157,46158,46159,46162,46163,46165,46166,46167,46169,46170,46171,46172,46173,46174,46175,46178,46180,46182,46183,46184,46185,46186,46187,46189,46190,46191,46192,46193,46194,46195,46196,46197,46198,46199,46200,46201,46202,46203,46204,46205,46206,46207,46209,46210,46211,46212,46213,46214,46215,46217,46218,46219,46220,46221,462Line truncated
|
||||
"gbk":[19970, 19972, 19973, 19974, 19983, 19986, 19991, 19999, 20000, 20001, 20003, 20006, 20009, 20014, 20015, 20017, 20019, 20021, 20023, 20028, 20032, 20033, 20034, 20036, 20038, 20042, 20049, 20053, 20055, 20058, 20059, 20066, 20067, 20068, 20069, 20071, 20072, 20074, 20075, 20076, 20077, 20078, 20079, 20082, 20084, 20085, 20086, 20087, 20088, 20089, 20090, 20091, 20092, 20093, 20095, 20096, 20097, 20098, 20099, 20100, 20101, 20103, 20106, 20112, 20118, 20119, 20121, 20124, 20125, 20126, 20131, 20138, 20143, 20144, 20145, 20148, 20150, 20151, 20152, 20153, 20156, 20157, 20158, 20168, 20172, 20175, 20176, 20178, 20186, 20187, 20188, 20192, 20194, 20198, 20199, 20201, 20205, 20206, 20207, 20209, 20212, 20216, 20217, 20218, 20220, 20222, 20224, 20226, 20227, 20228, 20229, 20230, 20231, 20232, 20235, 20236, 20242, 20243, 20244, 20245, 20246, 20252, 20253, 20257, 20259, 20264, 20265, 20268, 20269, 20270, 20273, 20275, 20277, 20279, 20281, 20283, 20286, 20287, 20288, 20289, 20290, 20292, 20293, 20295, 20296, 20297, 20298, 20299, 20300, 20306, 20308, 20310, 20321, 20322, 20326, 20328, 20330, 20331, 20333, 20334, 20337, 20338, 20341, 20343, 20344, 20345, 20346, 20349, 20352, 20353, 20354, 20357, 20358, 20359, 20362, 20364, 20366, 20368, 20370, 20371, 20373, 20374, 20376, 20377, 20378, 20380, 20382, 20383, 20385, 20386, 20388, 20395, 20397, 20400, 20401, 20402, 20403, 20404, 20406, 20407, 20408, 20409, 20410, 20411, 20412, 20413, 20414, 20416, 20417, 20418, 20422, 20423, 20424, 20425, 20427, 20428, 20429, 20434, 20435, 20436, 20437, 20438, 20441, 20443, 20448, 20450, 20452, 20453, 20455, 20459, 20460, 20464, 20466, 20468, 20469, 20470, 20471, 20473, 20475, 20476, 20477, 20479, 20480, 20481, 20482, 20483, 20484, 20485, 20486, 20487, 20488, 20489, 20490, 20491, 20494, 20496, 20497, 20499, 20501, 20502, 20503, 20507, 20509, 20510, 20512, 20514, 20515, 20516, 20519, 20523, 20527, 20528, 20529, 20530, 20531, 20532, 20533, 20534, 20535, 20536, 20537, 20539, 20541, 20543, 20544, 20545, 20546, 20548, 20549, 20550, 20553, 20554, 20555, 20557, 20560, 20561, 20562, 20563, 20564, 20566, 20567, 20568, 20569, 20571, 20573, 20574, 20575, 20576, 20577, 20578, 20579, 20580, 20582, 20583, 20584, 20585, 20586, 20587, 20589, 20590, 20591, 20592, 20593, 20594, 20595, 20596, 20597, 20600, 20601, 20602, 20604, 20605, 20609, 20610, 20611, 20612, 20614, 20615, 20617, 20618, 20619, 20620, 20622, 20623, 20624, 20625, 20626, 20627, 20628, 20629, 20630, 20631, 20632, 20633, 20634, 20635, 20636, 20637, 20638, 20639, 20640, 20641, 20642, 20644, 20646, 20650, 20651, 20653, 20654, 20655, 20656, 20657, 20659, 20660, 20661, 20662, 20663, 20664, 20665, 20668, 20669, 20670, 20671, 20672, 20673, 20674, 20675, 20676, 20677, 20678, 20679, 20680, 20681, 20682, 20683, 20684, 20685, 20686, 20688, 20689, 20690, 20691, 20692, 20693, 20695, 20696, 20697, 20699, 20700, 20701, 20702, 20703, 20704, 20705, 20706, 20707, 20708, 20709, 20712, 20713, 20714, 20715, 20719, 20720, 20721, 20722, 20724, 20726, 20727, 20728, 20729, 20730, 20732, 20733, 20734, 20735, 20736, 20737, 20738, 20739, 20740, 20741, 20744, 20745, 20746, 20748, 20749, 20750, 20751, 20752, 20753, 20755, 20756, 20757, 20758, 20759, 20760, 20761, 20762, 20763, 20764, 20765, 20766, 20767, 20768, 20770, 20771, 20772, 20773, 20774, 20775, 20776, 20777, 20778, 20779, 20780, 20781, 20782, 20783, 20784, 20785, 20786, 20787, 20788, 20789, 20790, 20791, 20792, 20793, 20794, 20795, 20796, 20797, 20798, 20802, 20807, 20810, 20812, 20814, 20815, 20816, 20818, 20819, 20823, 20824, 20825, 20827, 20829, 20830, 20831, 20832, 20833, 20835, 20836, 20838, 20839, 20841, 20842, 20847, 20850, 20858, 20862, 20863, 20867, 20868, 20870, 20871, 20874, 20875, 20878, 20879, 20880, 20881, 20883, 20884, 20888, 20890, 20893, 20894, 20895, 20897, 20899, 20902, 20903, 20904, 20905, 20906, 20909, 20910, 20916, 20920, 20921, 20922, 20926, 20927, 20929, 20930, 20931, 20933, 20936, 20938, 20941, 20942, 20944, 20946, 20947, 20948, 20949, 20950, 20951, 20952, 20953, 20954, 20956, 20958, 20959, 20962, 20963, 20965, 20966, 20967, 20968, 20969, 20970, 20972, 20974, 20977, 20978, 20980, 20983, 20990, 20996, 20997, 21001, 21003, 21004, 21007, 21008, 21011, 21012, 21013, 21020, 21022, 21023, 21025, 21026, 21027, 21029, 21030, 21031, 21034, 21036, 21039, 21041, 21042, 21044, 21045, 21052, 21054, 21060, 21061, 21062, 21063, 21064, 21065, 21067, 21070, 21071, 21074, 21075, 21077, 21079, 21080, 21081, 21082, 21083, 21085, 21087, 21088, 21090, 21091, 21092, 21094, 21096, 21099, 21100, 21101, 21102, 21104, 21105, 21107, 21108, 21109, 21110, 21111, 21112, 21113, 21114, 21115, 21116, 21118, 21120, 21123, 21124, 21125, 21126, 21127, 21129, 21130, 21131, 21132, 21133, 21134, 21135, 21137, 21138, 21140, 21141, 21142, 21143, 21144, 21145, 21146, 21148, 21156, 21157, 21158, 21159, 21166, 21167, 21168, 21172, 21173, 21174, 21175, 21176, 21177, 21178, 21179, 21180, 21181, 21184, 21185, 21186, 21188, 21189, 21190, 21192, 21194, 21196, 21197, 21198, 21199, 21201, 21203, 21204, 21205, 21207, 21209, 21210, 21211, 21212, 21213, 21214, 21216, 21217, 21218, 21219, 21221, 21222, 21223, 21224, 21225, 21226, 21227, 21228, 21229, 21230, 21231, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21240, 21243, 21244, 21245, 21249, 21250, 21251, 21252, 21255, 21257, 21258, 21259, 21260, 21262, 21265, 21266, 21267, 21268, 21272, 21275, 21276, 21278, 21279, 21282, 21284, 21285, 21287, 21288, 21289, 21291, 21292, 21293, 21295, 21296, 21297, 21298, 21299, 21300, 21301, 21302, 21303, 21304, 21308, 21309, 21312, 21314, 21316, 21318, 21323, 21324, 21325, 21328, 21332, 21336, 21337, 21339, 21341, 21349, 21352, 21354, 21356, 21357, 21362, 21366, 21369, 21371, 21372, 21373, 21374, 21376, 21377, 21379, 21383, 21384, 21386, 21390, 21391, 21392, 21393, 21394, 21395, 21396, 21398, 21399, 21401, 21403, 21404, 21406, 21408, 21409, 21412, 21415, 21418, 21419, 21420, 21421, 21423, 21424, 21425, 21426, 21427, 21428, 21429, 21431, 21432, 21433, 21434, 21436, 21437, 21438, 21440, 21443, 21444, 21445, 21446, 21447, 21454, 21455, 21456, 21458, 21459, 21461, 21466, 21468, 21469, 21470, 21473, 21474, 21479, 21492, 21498, 21502, 21503, 21504, 21506, 21509, 21511, 21515, 21524, 21528, 21529, 21530, 21532, 21538, 21540, 21541, 21546, 21552, 21555, 21558, 21559, 21562, 21565, 21567, 21569, 21570, 21572, 21573, 21575, 21577, 21580, 21581, 21582, 21583, 21585, 21594, 21597, 21598, 21599, 21600, 21601, 21603, 21605, 21607, 21609, 21610, 21611, 21612, 21613, 21614, 21615, 21616, 21620, 21625, 21626, 21630, 21631, 21633, 21635, 21637, 21639, 21640, 21641, 21642, 21645, 21649, 21651, 21655, 21656, 21660, 21662, 21663, 21664, 21665, 21666, 21669, 21678, 21680, 21682, 21685, 21686, 21687, 21689, 21690, 21692, 21694, 21699, 21701, 21706, 21707, 21718, 21720, 21723, 21728, 21729, 21730, 21731, 21732, 21739, 21740, 21743, 21744, 21745, 21748, 21749, 21750, 21751, 21752, 21753, 21755, 21758, 21760, 21762, 21763, 21764, 21765, 21768, 21770, 21771, 21772, 21773, 21774, 21778, 21779, 21781, 21782, 21783, 21784, 21785, 21786, 21788, 21789, 21790, 21791, 21793, 21797, 21798, 21800, 21801, 21803, 21805, 21810, 21812, 21813, 21814, 21816, 21817, 21818, 21819, 21821, 21824, 21826, 21829, 21831, 21832, 21835, 21836, 21837, 21838, 21839, 21841, 21842, 21843, 21844, 21847, 21848, 21849, 21850, 21851, 21853, 21854, 21855, 21856, 21858, 21859, 21864, 21865, 21867, 21871, 21872, 21873, 21874, 21875, 21876, 21881, 21882, 21885, 21887, 21893, 21894, 21900, 21901, 21902, 21904, 21906, 21907, 21909, 21910, 21911, 21914, 21915, 21918, 21920, 21921, 21922, 21923, 21924, 21925, 21926, 21928, 21929, 21930, 21931, 21932, 21933, 21934, 21935, 21936, 21938, 21940, 21942, 21944, 21946, 21948, 21951, 21952, 21953, 21954, 21955, 21958, 21959, 21960, 21962, 21963, 21966, 21967, 21968, 21973, 21975, 21976, 21977, 21978, 21979, 21982, 21984, 21986, 21991, 21993, 21997, 21998, 22000, 22001, 22004, 22006, 22008, 22009, 22010, 22011, 22012, 22015, 22018, 22019, 22020, 22021, 22022, 22023, 22026, 22027, 22029, 22032, 22033, 22034, 22035, 22036, 22037, 22038, 22039, 22041, 22042, 22044, 22045, 22048, 22049, 22050, 22053, 22054, 22056, 22057, 22058, 22059, 22062, 22063, 22064, 22067, 22069, 22071, 22072, 22074, 22076, 22077, 22078, 22080, 22081, 22082, 22083, 22084, 22085, 22086, 22087, 22088, 22089, 22090, 22091, 22095, 22096, 22097, 22098, 22099, 22101, 22102, 22106, 22107, 22109, 22110, 22111, 22112, 22113, 22115, 22117, 22118, 22119, 22125, 22126, 22127, 22128, 22130, 22131, 22132, 22133, 22135, 22136, 22137, 22138, 22141, 22142, 22143, 22144, 22145, 22146, 22147, 22148, 22151, 22152, 22153, 22154, 22155, 22156, 22157, 22160, 22161, 22162, 22164, 22165, 22166, 22167, 22168, 22169, 22170, 22171, 22172, 22173, 22174, 22175, 22176, 22177, 22178, 22180, 22181, 22182, 22183, 22184, 22185, 22186, 22187, 22188, 22189, 22190, 22192, 22193, 22194, 22195, 22196, 22197, 22198, 22200, 22201, 22202, 22203, 22205, 22206, 22207, 22208, 22209, 22210, 22211, 22212, 22213, 22214, 22215, 22216, 22217, 22219, 22220, 22221, 22222, 22223, 22224, 22225, 22226, 22227, 22229, 22230, 22232, 22233, 22236, 22243, 22245, 22246, 22247, 22248, 22249, 22250, 22252, 22254, 22255, 22258, 22259, 22262, 22263, 22264, 22267, 22268, 22272, 22273, 22274, 22277, 22279, 22283, 22284, 22285, 22286, 22287, 22288, 22289, 22290, 22291, 22292, 22293, 22294, 22295, 22296, 22297, 22298, 22299, 22301, 22302, 22304, 22305, 22306, 22308, 22309, 22310, 22311, 22315, 22321, 22322, 22324, 22325, 22326, 22327, 22328, 22332, 22333, 22335, 22337, 22339, 22340, 22341, 22342, 22344, 22345, 22347, 22354, 22355, 22356, 22357, 22358, 22360, 22361, 22370, 22371, 22373, 22375, 22380, 22382, 22384, 22385, 22386, 22388, 22389, 22392, 22393, 22394, 22397, 22398, 22399, 22400, 22401, 22407, 22408, 22409, 22410, 22413, 22414, 22415, 22416, 22417, 22420, 22421, 22422, 22423, 22424, 22425, 22426, 22428, 22429, 22430, 22431, 22437, 22440, 22442, 22444, 22447, 22448, 22449, 22451, 22453, 22454, 22455, 22457, 22458, 2Line truncated
|
||||
"gb18030":[[0, 128], [36, 165], [38, 169], [45, 178], [50, 184], [81, 216], [89, 226], [95, 235], [96, 238], [100, 244], [103, 248], [104, 251], [105, 253], [109, 258], [126, 276], [133, 284], [148, 300], [172, 325], [175, 329], [179, 334], [208, 364], [306, 463], [307, 465], [308, 467], [309, 469], [310, 471], [311, 473], [312, 475], [313, 477], [341, 506], [428, 594], [443, 610], [544, 712], [545, 716], [558, 730], [741, 930], [742, 938], [749, 962], [750, 970], [805, 1026], [819, 1104], [820, 1106], [7922, 8209], [7924, 8215], [7925, 8218], [7927, 8222], [7934, 8231], [7943, 8241], [7944, 8244], [7945, 8246], [7950, 8252], [8062, 8365], [8148, 8452], [8149, 8454], [8152, 8458], [8164, 8471], [8174, 8482], [8236, 8556], [8240, 8570], [8262, 8596], [8264, 8602], [8374, 8713], [8380, 8720], [8381, 8722], [8384, 8726], [8388, 8731], [8390, 8737], [8392, 8740], [8393, 8742], [8394, 8748], [8396, 8751], [8401, 8760], [8406, 8766], [8416, 8777], [8419, 8781], [8424, 8787], [8437, 8802], [8439, 8808], [8445, 8816], [8482, 8854], [8485, 8858], [8496, 8870], [8521, 8896], [8603, 8979], [8936, 9322], [8946, 9372], [9046, 9548], [9050, 9588], [9063, 9616], [9066, 9622], [9076, 9634], [9092, 9652], [9100, 9662], [9108, 9672], [9111, 9676], [9113, 9680], [9131, 9702], [9162, 9735], [9164, 9738], [9218, 9793], [9219, 9795], [11329, 11906], [11331, 11909], [11334, 11913], [11336, 11917], [11346, 11928], [11361, 11944], [11363, 11947], [11366, 11951], [11370, 11956], [11372, 11960], [11375, 11964], [11389, 11979], [11682, 12284], [11686, 12292], [11687, 12312], [11692, 12319], [11694, 12330], [11714, 12351], [11716, 12436], [11723, 12447], [11725, 12535], [11730, 12543], [11736, 12586], [11982, 12842], [11989, 12850], [12102, 12964], [12336, 13200], [12348, 13215], [12350, 13218], [12384, 13253], [12393, 13263], [12395, 13267], [12397, 13270], [12510, 13384], [12553, 13428], [12851, 13727], [12962, 13839], [12973, 13851], [13738, 14617], [13823, 14703], [13919, 14801], [13933, 14816], [14080, 14964], [14298, 15183], [14585, 15471], [14698, 15585], [15583, 16471], [15847, 16736], [16318, 17208], [16434, 17325], [16438, 17330], [16481, 17374], [16729, 17623], [17102, 17997], [17122, 18018], [17315, 18212], [17320, 18218], [17402, 18301], [17418, 18318], [17859, 18760], [17909, 18811], [17911, 18814], [17915, 18820], [17916, 18823], [17936, 18844], [17939, 18848], [17961, 18872], [18664, 19576], [18703, 19620], [18814, 19738], [18962, 19887], [19043, 40870], [33469, 59244], [33470, 59336], [33471, 59367], [33484, 59413], [33485, 59417], [33490, 59423], [33497, 59431], [33501, 59437], [33505, 59443], [33513, 59452], [33520, 59460], [33536, 59478], [33550, 59493], [37845, 63789], [37921, 63866], [37948, 63894], [38029, 63976], [38038, 63986], [38064, 64016], [38065, 64018], [38066, 64021], [38069, 64025], [38075, 64034], [38076, 64037], [38078, 64042], [39108, 65074], [39109, 65093], [39113, 65107], [39114, 65112], [39115, 65127], [39116, 65132], [39265, 65375], [39394, 65510], [189000, 65536]],
|
||||
"jis0208":[12288, 12289, 12290, 65292, 65294, 12539, 65306, 65307, 65311, 65281, 12443, 12444, 180, 65344, 168, 65342, 65507, 65343, 12541, 12542, 12445, 12446, 12291, 20189, 12293, 12294, 12295, 12540, 8213, 8208, 65295, 65340, 65374, 8741, 65372, 8230, 8229, 8216, 8217, 8220, 8221, 65288, 65289, 12308, 12309, 65339, 65341, 65371, 65373, 12296, 12297, 12298, 12299, 12300, 12301, 12302, 12303, 12304, 12305, 65291, 65293, 177, 215, 247, 65309, 8800, 65308, 65310, 8806, 8807, 8734, 8756, 9794, 9792, 176, 8242, 8243, 8451, 65509, 65284, 65504, 65505, 65285, 65283, 65286, 65290, 65312, 167, 9734, 9733, 9675, 9679, 9678, 9671, 9670, 9633, 9632, 9651, 9650, 9661, 9660, 8251, 12306, 8594, 8592, 8593, 8595, 12307, null, null, null, null, null, null, null, null, null, null, null, 8712, 8715, 8838, 8839, 8834, 8835, 8746, 8745, null, null, null, null, null, null, null, null, 8743, 8744, 65506, 8658, 8660, 8704, 8707, null, null, null, null, null, null, null, null, null, null, null, 8736, 8869, 8978, 8706, 8711, 8801, 8786, 8810, 8811, 8730, 8765, 8733, 8757, 8747, 8748, null, null, null, null, null, null, null, 8491, 8240, 9839, 9837, 9834, 8224, 8225, 182, null, null, null, null, 9711, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 65296, 65297, 65298, 65299, 65300, 65301, 65302, 65303, 65304, 65305, null, null, null, null, null, null, null, 65313, 65314, 65315, 65316, 65317, 65318, 65319, 65320, 65321, 65322, 65323, 65324, 65325, 65326, 65327, 65328, 65329, 65330, 65331, 65332, 65333, 65334, 65335, 65336, 65337, 65338, null, null, null, null, null, null, 65345, 65346, 65347, 65348, 65349, 65350, 65351, 65352, 65353, 65354, 65355, 65356, 65357, 65358, 65359, 65360, 65361, 65362, 65363, 65364, 65365, 65366, 65367, 65368, 65369, 65370, null, null, null, null, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12400, 12401, 12402, 12403, 12404, 12405, 12406, 12407, 12408, 12409, 12410, 12411, 12412, 12413, 12414, 12415, 12416, 12417, 12418, 12419, 12420, 12421, 12422, 12423, 12424, 12425, 12426, 12427, 12428, 12429, 12430, 12431, 12432, 12433, 12434, 12435, null, null, null, null, null, null, null, null, null, null, null, 12449, 12450, 12451, 12452, 12453, 12454, 12455, 12456, 12457, 12458, 12459, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12484, 12485, 12486, 12487, 12488, 12489, 12490, 12491, 12492, 12493, 12494, 12495, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12511, 12512, 12513, 12514, 12515, 12516, 12517, 12518, 12519, 12520, 12521, 12522, 12523, 12524, 12525, 12526, 12527, 12528, 12529, 12530, 12531, 12532, 12533, 12534, null, null, null, null, null, null, null, null, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, null, null, null, null, null, null, null, null, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 963, 964, 965, 966, 967, 968, 969, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1040, 1041, 1042, 1043, 1044, 1045, 1025, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1072, 1073, 1074, 1075, 1076, 1077, 1105, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, null, null, null, null, null, null, null, null, null, null, null, null, null, 9472, 9474, 9484, 9488, 9496, 9492, 9500, 9516, 9508, 9524, 9532, 9473, 9475, 9487, 9491, 9499, 9495, 9507, 9523, 9515, 9531, 9547, 9504, 9519, 9512, 9527, 9535, 9501, 9520, 9509, 9528, 9538, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 9312, 9313, 9314, 9315, 9316, 9317, 9318, 9319, 9320, 9321, 9322, 9323, 9324, 9325, 9326, 9327, 9328, 9329, 9330, 9331, 8544, 8545, 8546, 8547, 8548, 8549, 8550, 8551, 8552, 8553, null, 13129, 13076, 13090, 13133, 13080, 13095, 13059, 13110, 13137, 13143, 13069, 13094, 13091, 13099, 13130, 13115, 13212, 13213, 13214, 13198, 13199, 13252, 13217, null, null, null, null, null, null, null, null, 13179, 12317, 12319, 8470, 13261, 8481, 12964, 12965, 12966, 12967, 12968, 12849, 12850, 12857, 13182, 13181, 13180, 8786, 8801, 8747, 8750, 8721, 8730, 8869, 8736, 8735, 8895, 8757, 8745, 8746, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 20124, 21782, 23043, 38463, 21696, 24859, 25384, 23030, 36898, 33909, 33564, 31312, 24746, 25569, 28197, 26093, 33894, 33446, 39925, 26771, 22311, 26017, 25201, 23451, 22992, 34427, 39156, 32098, 32190, 39822, 25110, 31903, 34999, 23433, 24245, 25353, 26263, 26696, 38343, 38797, 26447, 20197, 20234, 20301, 20381, 20553, 22258, 22839, 22996, 23041, 23561, 24799, 24847, 24944, 26131, 26885, 28858, 30031, 30064, 31227, 32173, 32239, 32963, 33806, 34915, 35586, 36949, 36986, 21307, 20117, 20133, 22495, 32946, 37057, 30959, 19968, 22769, 28322, 36920, 31282, 33576, 33419, 39983, 20801, 21360, 21693, 21729, 22240, 23035, 24341, 39154, 28139, 32996, 34093, 38498, 38512, 38560, 38907, 21515, 21491, 23431, 28879, 32701, 36802, 38632, 21359, 40284, 31418, 19985, 30867, 33276, 28198, 22040, 21764, 27421, 34074, 39995, 23013, 21417, 28006, 29916, 38287, 22082, 20113, 36939, 38642, 33615, 39180, 21473, 21942, 23344, 24433, 26144, 26355, 26628, 27704, 27891, 27945, 29787, 30408, 31310, 38964, 33521, 34907, 35424, 37613, 28082, 30123, 30410, 39365, 24742, 35585, 36234, 38322, 27022, 21421, 20870, 22290, 22576, 22852, 23476, 24310, 24616, 25513, 25588, 27839, 28436, 28814, 28948, 29017, 29141, 29503, 32257, 33398, 33489, 34199, 36960, 37467, 40Line truncated
|
||||
"jis0212":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,728,711,184,729,733,175,731,730,65374,900,901,null,null,null,null,null,null,null,null,161,166,191,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,186,170,169,174,8482,164,8470,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,902,904,905,906,938,null,908,null,910,939,null,911,null,null,null,null,940,941,942,943,970,912,972,962,973,971,944,974,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1038,1039,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1118,1119,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,198,272,null,294,null,306,null,321,319,null,330,216,338,null,358,222,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,230,273,240,295,305,307,312,322,320,329,331,248,339,223,359,254,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,193,192,196,194,258,461,256,260,197,195,262,264,268,199,266,270,201,200,203,202,282,278,274,280,null,284,286,290,288,292,205,204,207,206,463,304,298,302,296,308,310,313,317,315,323,327,325,209,211,210,214,212,465,336,332,213,340,344,342,346,348,352,350,356,354,218,217,220,219,364,467,368,362,370,366,360,471,475,473,469,372,221,376,374,377,381,379,null,null,null,null,null,null,null,225,224,228,226,259,462,257,261,229,227,263,265,269,231,267,271,233,232,235,234,283,279,275,281,501,285,287,null,289,293,237,236,239,238,464,null,299,303,297,309,311,314,318,316,324,328,326,241,243,242,246,244,466,337,333,245,341,345,343,347,349,353,351,357,355,250,249,252,251,365,468,369,363,371,367,361,472,476,474,470,373,253,255,375,378,382,380,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,19970,19972,19973,19980,19986,19999,20003,20004,20008,20011,20014,20015,20016,20021,20032,20033,20036,20039,20049,20058,20060,20067,20072,20073,20084,20085,20089,20095,20109,20118,20119,20125,20143,20153,20163,20176,20186,20187,20192,20193,20194,20200,20207,20209,20211,20213,20221,20222,20223,20224,20226,20227,20232,20235,20236,20242,20245,20246,20247,20249,20270,20273,20320,20275,20277,20279,20281,20283,20286,20288,20290,20296,20297,20299,20300,20306,20308,20310,20312,20319,20323,20330,20332,20334,20337,20343,20344,20345,20346,20349,20350,20353,20354,20356,20357,20361,20362,20364,20366,20368,20370,20371,20372,20375,20377,20378,20382,20383,20402,20407,20409,20411,20412,20413,20414,20416,20417,20421,20422,20424,20425,20427,20428,20429,20431,20434,20444,20448,20450,20464,20466,20476,20477,20479,20480,20481,20484,20487,20490,20492,20494,20496,20499,20503,20504,20507,20508,20509,20510,20514,20519,20526,20528,20530,20531,20533,20544,20545,20546,20549,20550,20554,20556,20558,20561,20562,20563,20567,20569,20575,20576,20578,20579,20582,20583,20586,20589,20592,20593,20539,20609,20611,20612,20614,20618,20622,20623,20624,20626,20627,20628,20630,20635,20636,20638,20639,20640,20641,20642,20650,20655,20656,20665,20666,20669,20672,20675,20676,20679,20684,20686,20688,20691,20692,20696,20700,20701,20703,20706,20708,20710,20712,20713,20719,20721,20726,20730,20734,20739,20742,20743,20744,20747,20748,20749,20750,20722,20752,20759,20761,20763,20764,20765,20766,20771,20775,20776,20780,20781,20783,20785,20787,20788,20789,20792,20793,20802,20810,20815,20819,20821,20823,20824,20831,20836,20838,20862,20867,20868,20875,20878,20888,20893,20897,20899,20909,20920,20922,20924,20926,20927,20930,20936,20943,20945,20946,20947,20949,20952,20958,20962,20965,20974,20978,20979,20980,20983,20993,20994,20997,21010,21011,21013,21014,21016,21026,21032,21041,21042,21045,21052,21061,21065,21077,21079,21080,21082,21084,21087,21088,21089,21094,21102,21111,21112,21113,21120,21122,21125,21130,21132,21139,21141,21142,21143,21144,21146,21148,21156,21157,21158,21159,21167,21168,21174,21175,21176,21178,21179,21181,21184,21188,21190,21192,21196,21199,21201,21204,21206,21211,21212,21217,21221,21224,21225,21226,21228,21232,21233,21236,21238,21239,21248,21251,21258,21259,21260,21265,21267,21272,21275,21276,21278,21279,21285,21287,21288,21289,21291,21292,21293,21296,21298,21301,21308,21309,21310,21314,21324,21323,21337,21339,21345,21347,21349,21356,21357,21362,21369,21374,21379,21383,21384,21390,21395,21396,21401,21405,21409,21412,21418,21419,21423,21426,21428,21429,21431,21432,21434,21437,21440,21445,21455,21458,21459,21461,21466,21469,21470,21472,21478,21479,21493,21506,21523,21530,21537,21543,21544,21546,21551,21553,21556,21557,21571,21572,21575,21581,21583,21598,21602,21604,21606,21607,21609,21611,21613,21614,21620,21631,21633,21635,21637,21640,21641,21645,21649,21653,21654,21660,21663,21665,21670,21671,21673,21674,21677,21678,21681,21687,21689,21690,21691,21695,21702,21706,21709,21710,21728,21738,21740,21743,21750,21756,21758,21759,21760,21761,21765,21768,21769,21772,21773,21774,21781,21802,21803,21810,21813,21814,21819,21820,21821,21825,21831,21833,21834,21837,2184Line truncated
|
||||
"ibm864":[176,183,8729,8730,9618,9472,9474,9532,9508,9516,9500,9524,9488,9484,9492,9496,946,8734,966,177,189,188,8776,171,187,65271,65272,155,156,65275,65276,159,160,173,65154,163,164,65156,null,null,65166,65167,65173,65177,1548,65181,65185,65189,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,65233,1563,65201,65205,65209,1567,162,65152,65153,65155,65157,65226,65163,65165,65169,65171,65175,65179,65183,65187,65191,65193,65195,65197,65199,65203,65207,65211,65215,65217,65221,65227,65231,166,172,247,215,65225,1600,65235,65239,65243,65247,65251,65255,65259,65261,65263,65267,65213,65228,65230,65229,65249,65149,1617,65253,65257,65260,65264,65266,65232,65237,65269,65270,65245,65241,65265,9632,null],
|
||||
"ibm866":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488,9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575,9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1025,1105,1028,1108,1031,1111,1038,1118,176,8729,183,8730,8470,164,9632,160],
|
||||
"iso-8859-2":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,728,321,164,317,346,167,168,352,350,356,377,173,381,379,176,261,731,322,180,318,347,711,184,353,351,357,378,733,382,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],
|
||||
"iso-8859-3":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,294,728,163,164,null,292,167,168,304,350,286,308,173,null,379,176,295,178,179,180,181,293,183,184,305,351,287,309,189,null,380,192,193,194,null,196,266,264,199,200,201,202,203,204,205,206,207,null,209,210,211,212,288,214,215,284,217,218,219,220,364,348,223,224,225,226,null,228,267,265,231,232,233,234,235,236,237,238,239,null,241,242,243,244,289,246,247,285,249,250,251,252,365,349,729],
|
||||
"iso-8859-4":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,312,342,164,296,315,167,168,352,274,290,358,173,381,175,176,261,731,343,180,297,316,711,184,353,275,291,359,330,382,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,298,272,325,332,310,212,213,214,215,216,370,218,219,220,360,362,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,299,273,326,333,311,244,245,246,247,248,371,250,251,252,361,363,729],
|
||||
"iso-8859-5":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,173,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,8470,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,167,1118,1119],
|
||||
"iso-8859-6":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,null,null,164,null,null,null,null,null,null,null,1548,173,null,null,null,null,null,null,null,null,null,null,null,null,null,1563,null,null,null,1567,null,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,null,null,null,null,null,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,null,null,null,null,null,null,null,null,null,null,null,null,null],
|
||||
"iso-8859-7":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8216,8217,163,8364,8367,166,167,168,169,890,171,172,173,null,8213,176,177,178,179,900,901,902,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],
|
||||
"iso-8859-8":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,null,162,163,164,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8215,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],
|
||||
"iso-8859-10":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,274,290,298,296,310,167,315,272,352,358,381,173,362,330,176,261,275,291,299,297,311,183,316,273,353,359,382,8213,363,331,256,193,194,195,196,197,198,302,268,201,280,203,278,205,206,207,208,325,332,211,212,213,214,360,216,370,218,219,220,221,222,223,257,225,226,227,228,229,230,303,269,233,281,235,279,237,238,239,240,326,333,243,244,245,246,361,248,371,250,251,252,253,254,312],
|
||||
"iso-8859-13":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,8221,162,163,164,8222,166,167,216,169,342,171,172,173,174,198,176,177,178,179,8220,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,8217],
|
||||
"iso-8859-14":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,7682,7683,163,266,267,7690,167,7808,169,7810,7691,7922,173,174,376,7710,7711,288,289,7744,7745,182,7766,7809,7767,7811,7776,7923,7812,7813,7777,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,372,209,210,211,212,213,214,7786,216,217,218,219,220,221,374,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,373,241,242,243,244,245,246,7787,248,249,250,251,252,253,375,255],
|
||||
"iso-8859-15":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,8364,165,352,167,353,169,170,171,172,173,174,175,176,177,178,179,381,181,182,183,382,185,186,187,338,339,376,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],
|
||||
"iso-8859-16":[128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,260,261,321,8364,8222,352,167,353,169,536,171,377,173,378,379,176,177,268,322,381,8221,182,183,382,269,537,187,338,339,376,380,192,193,194,258,196,262,198,199,200,201,202,203,204,205,206,207,272,323,210,211,212,336,214,346,368,217,218,219,220,280,538,223,224,225,226,259,228,263,230,231,232,233,234,235,236,237,238,239,273,324,242,243,244,337,246,347,369,249,250,251,252,281,539,255],
|
||||
"koi8-r":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,1025,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],
|
||||
"koi8-u":[9472,9474,9484,9488,9492,9496,9500,9508,9516,9524,9532,9600,9604,9608,9612,9616,9617,9618,9619,8992,9632,8729,8730,8776,8804,8805,160,8993,176,178,183,247,9552,9553,9554,1105,1108,9556,1110,1111,9559,9560,9561,9562,9563,1169,9565,9566,9567,9568,9569,1025,1028,9571,1030,1031,9574,9575,9576,9577,9578,1168,9580,169,1102,1072,1073,1094,1076,1077,1092,1075,1093,1080,1081,1082,1083,1084,1085,1086,1087,1103,1088,1089,1090,1091,1078,1074,1100,1099,1079,1096,1101,1097,1095,1098,1070,1040,1041,1062,1044,1045,1060,1043,1061,1048,1049,1050,1051,1052,1053,1054,1055,1071,1056,1057,1058,1059,1046,1042,1068,1067,1047,1064,1069,1065,1063,1066],
|
||||
"macintosh":[196,197,199,201,209,214,220,225,224,226,228,227,229,231,233,232,234,235,237,236,238,239,241,243,242,244,246,245,250,249,251,252,8224,176,162,163,167,8226,182,223,174,169,8482,180,168,8800,198,216,8734,177,8804,8805,165,181,8706,8721,8719,960,8747,170,186,937,230,248,191,161,172,8730,402,8776,8710,171,187,8230,160,192,195,213,338,339,8211,8212,8220,8221,8216,8217,247,9674,255,376,8260,8364,8249,8250,64257,64258,8225,183,8218,8222,8240,194,202,193,203,200,205,206,207,204,211,212,63743,210,218,219,217,305,710,732,175,728,729,730,184,733,731,711],
|
||||
"windows-874":[8364,129,130,131,132,8230,134,135,136,137,138,139,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,153,154,155,156,157,158,159,160,3585,3586,3587,3588,3589,3590,3591,3592,3593,3594,3595,3596,3597,3598,3599,3600,3601,3602,3603,3604,3605,3606,3607,3608,3609,3610,3611,3612,3613,3614,3615,3616,3617,3618,3619,3620,3621,3622,3623,3624,3625,3626,3627,3628,3629,3630,3631,3632,3633,3634,3635,3636,3637,3638,3639,3640,3641,3642,null,null,null,null,3647,3648,3649,3650,3651,3652,3653,3654,3655,3656,3657,3658,3659,3660,3661,3662,3663,3664,3665,3666,3667,3668,3669,3670,3671,3672,3673,3674,3675,null,null,null,null],
|
||||
"windows-1250":[8364,129,8218,131,8222,8230,8224,8225,136,8240,352,8249,346,356,381,377,144,8216,8217,8220,8221,8226,8211,8212,152,8482,353,8250,347,357,382,378,160,711,728,321,164,260,166,167,168,169,350,171,172,173,174,379,176,177,731,322,180,181,182,183,184,261,351,187,317,733,318,380,340,193,194,258,196,313,262,199,268,201,280,203,282,205,206,270,272,323,327,211,212,336,214,215,344,366,218,368,220,221,354,223,341,225,226,259,228,314,263,231,269,233,281,235,283,237,238,271,273,324,328,243,244,337,246,247,345,367,250,369,252,253,355,729],
|
||||
"windows-1251":[1026,1027,8218,1107,8222,8230,8224,8225,8364,8240,1033,8249,1034,1036,1035,1039,1106,8216,8217,8220,8221,8226,8211,8212,152,8482,1113,8250,1114,1116,1115,1119,160,1038,1118,1032,164,1168,166,167,1025,169,1028,171,172,173,174,1031,176,177,1030,1110,1169,181,182,183,1105,8470,1108,187,1112,1029,1109,1111,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103],
|
||||
"windows-1252":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255],
|
||||
"windows-1253":[8364,129,8218,402,8222,8230,8224,8225,136,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,157,158,159,160,901,902,163,164,165,166,167,168,169,null,171,172,173,174,8213,176,177,178,179,900,181,182,183,904,905,906,187,908,189,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,null,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,null],
|
||||
"windows-1254":[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,286,209,210,211,212,213,214,215,216,217,218,219,220,304,350,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,287,241,242,243,244,245,246,247,248,249,250,251,252,305,351,255],
|
||||
"windows-1255":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,140,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,156,157,158,159,160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,null,1467,1468,1469,1470,1471,1472,1473,1474,1475,1520,1521,1522,1523,1524,null,null,null,null,null,null,null,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,null,null,8206,8207,null],
|
||||
"windows-1256":[8364,1662,8218,402,8222,8230,8224,8225,710,8240,1657,8249,338,1670,1688,1672,1711,8216,8217,8220,8221,8226,8211,8212,1705,8482,1681,8250,339,8204,8205,1722,160,1548,162,163,164,165,166,167,168,169,1726,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,1563,187,188,189,190,1567,1729,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,215,1591,1592,1593,1594,1600,1601,1602,1603,224,1604,226,1605,1606,1607,1608,231,232,233,234,235,1609,1610,238,239,1611,1612,1613,1614,244,1615,1616,247,1617,249,1618,251,252,8206,8207,1746],
|
||||
"windows-1257":[8364,129,8218,131,8222,8230,8224,8225,136,8240,138,8249,140,168,711,184,144,8216,8217,8220,8221,8226,8211,8212,152,8482,154,8250,156,175,731,159,160,null,162,163,164,null,166,167,216,169,342,171,172,173,174,198,176,177,178,179,180,181,182,183,248,185,343,187,188,189,190,230,260,302,256,262,196,197,280,274,268,201,377,278,290,310,298,315,352,323,325,211,332,213,214,215,370,321,346,362,220,379,381,223,261,303,257,263,228,229,281,275,269,233,378,279,291,311,299,316,353,324,326,243,333,245,246,247,371,322,347,363,252,380,382,729],
|
||||
"windows-1258":[8364,129,8218,402,8222,8230,8224,8225,710,8240,138,8249,338,141,142,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,154,8250,339,157,158,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,258,196,197,198,199,200,201,202,203,768,205,206,207,272,209,777,211,212,416,214,215,216,217,218,219,220,431,771,223,224,225,226,259,228,229,230,231,232,233,234,235,769,237,238,239,273,241,803,243,244,417,246,247,248,249,250,251,252,432,8363,255],
|
||||
"x-mac-cyrillic":[1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,8224,176,1168,163,167,8226,182,1030,174,169,8482,1026,1106,8800,1027,1107,8734,177,8804,8805,1110,181,1169,1032,1028,1108,1031,1111,1033,1113,1034,1114,1112,1029,172,8730,402,8776,8710,171,187,8230,160,1035,1115,1036,1116,1109,8211,8212,8220,8221,8216,8217,247,8222,1038,1118,1039,1119,8470,1025,1105,1103,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,8364]
|
||||
};
|
||||
+2340
@@ -0,0 +1,2340 @@
|
||||
/*
|
||||
Modifications for better node.js integration:
|
||||
Copyright 2013 Brian White. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
Original source code:
|
||||
Copyright 2012 Joshua Bell
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// Utilities
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {number} a The number to test.
|
||||
* @param {number} min The minimum value in the range, inclusive.
|
||||
* @param {number} max The maximum value in the range, inclusive.
|
||||
* @return {boolean} True if a >= min and a <= max.
|
||||
*/
|
||||
function inRange(a, min, max) {
|
||||
return min <= a && a <= max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} n The numerator.
|
||||
* @param {number} d The denominator.
|
||||
* @return {number} The result of the integer division of n by d.
|
||||
*/
|
||||
function div(n, d) {
|
||||
return Math.floor(n / d);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Implementation of Encoding specification
|
||||
// http://dvcs.w3.org/hg/encoding/raw-file/tip/Overview.html
|
||||
//
|
||||
|
||||
//
|
||||
// 3. Terminology
|
||||
//
|
||||
|
||||
//
|
||||
// 4. Encodings
|
||||
//
|
||||
|
||||
/** @const */ var EOF_byte = -1;
|
||||
/** @const */ var EOF_code_point = -1;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Buffer} bytes Array of bytes that provide the stream.
|
||||
*/
|
||||
function ByteInputStream(bytes) {
|
||||
/** @type {number} */
|
||||
var pos = 0;
|
||||
|
||||
/** @return {number} Get the next byte from the stream. */
|
||||
this.get = function() {
|
||||
return (pos >= bytes.length) ? EOF_byte : Number(bytes[pos]);
|
||||
};
|
||||
|
||||
/** @param {number} n Number (positive or negative) by which to
|
||||
* offset the byte pointer. */
|
||||
this.offset = function(n) {
|
||||
pos += n;
|
||||
if (pos < 0) {
|
||||
throw new Error('Seeking past start of the buffer');
|
||||
}
|
||||
if (pos > bytes.length) {
|
||||
throw new Error('Seeking past EOF');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} test Array of bytes to compare against.
|
||||
* @return {boolean} True if the start of the stream matches the test
|
||||
* bytes.
|
||||
*/
|
||||
this.match = function(test) {
|
||||
if (test.length > pos + bytes.length) {
|
||||
return false;
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < test.length; i += 1) {
|
||||
if (Number(bytes[pos + i]) !== test[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array.<number>} bytes The array to write bytes into.
|
||||
*/
|
||||
function ByteOutputStream(bytes) {
|
||||
/** @type {number} */
|
||||
var pos = 0;
|
||||
|
||||
/**
|
||||
* @param {...number} var_args The byte or bytes to emit into the stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.emit = function(var_args) {
|
||||
/** @type {number} */
|
||||
var last = EOF_byte;
|
||||
var i;
|
||||
for (i = 0; i < arguments.length; ++i) {
|
||||
last = Number(arguments[i]);
|
||||
bytes[pos++] = last;
|
||||
}
|
||||
return last;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} string The source of code units for the stream.
|
||||
*/
|
||||
function CodePointInputStream(string) {
|
||||
/**
|
||||
* @param {string} string Input string of UTF-16 code units.
|
||||
* @return {Array.<number>} Code points.
|
||||
*/
|
||||
function stringToCodePoints(string) {
|
||||
/** @type {Array.<number>} */
|
||||
var cps = [];
|
||||
// Based on http://www.w3.org/TR/WebIDL/#idl-DOMString
|
||||
var i = 0, n = string.length;
|
||||
while (i < string.length) {
|
||||
var c = string.charCodeAt(i);
|
||||
if (!inRange(c, 0xD800, 0xDFFF)) {
|
||||
cps.push(c);
|
||||
} else if (inRange(c, 0xDC00, 0xDFFF)) {
|
||||
cps.push(0xFFFD);
|
||||
} else { // (inRange(cu, 0xD800, 0xDBFF))
|
||||
if (i === n - 1) {
|
||||
cps.push(0xFFFD);
|
||||
} else {
|
||||
var d = string.charCodeAt(i + 1);
|
||||
if (inRange(d, 0xDC00, 0xDFFF)) {
|
||||
var a = c & 0x3FF;
|
||||
var b = d & 0x3FF;
|
||||
i += 1;
|
||||
cps.push(0x10000 + (a << 10) + b);
|
||||
} else {
|
||||
cps.push(0xFFFD);
|
||||
}
|
||||
}
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
return cps;
|
||||
}
|
||||
|
||||
/** @type {number} */
|
||||
var pos = 0;
|
||||
/** @type {Array.<number>} */
|
||||
var cps = stringToCodePoints(string);
|
||||
|
||||
/** @param {number} n The number of bytes (positive or negative)
|
||||
* to advance the code point pointer by.*/
|
||||
this.offset = function(n) {
|
||||
pos += n;
|
||||
if (pos < 0) {
|
||||
throw new Error('Seeking past start of the buffer');
|
||||
}
|
||||
if (pos > cps.length) {
|
||||
throw new Error('Seeking past EOF');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** @return {number} Get the next code point from the stream. */
|
||||
this.get = function() {
|
||||
if (pos >= cps.length) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
return cps[pos];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function CodePointOutputStream() {
|
||||
/** @type {string} */
|
||||
var string = '';
|
||||
|
||||
/** @return {string} The accumulated string. */
|
||||
this.string = function() {
|
||||
return string;
|
||||
};
|
||||
|
||||
/** @param {number} c The code point to encode into the stream. */
|
||||
this.emit = function(c) {
|
||||
if (c <= 0xFFFF) {
|
||||
string += String.fromCharCode(c);
|
||||
} else {
|
||||
c -= 0x10000;
|
||||
string += String.fromCharCode(0xD800 + ((c >> 10) & 0x3ff));
|
||||
string += String.fromCharCode(0xDC00 + (c & 0x3ff));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} message Description of the error.
|
||||
*/
|
||||
function EncodingError(message) {
|
||||
this.name = 'EncodingError';
|
||||
this.message = message;
|
||||
this.code = 0;
|
||||
}
|
||||
EncodingError.prototype = Error.prototype;
|
||||
|
||||
/**
|
||||
* @param {boolean} fatal If true, decoding errors raise an exception.
|
||||
* @param {number=} opt_code_point Override the standard fallback code point.
|
||||
* @return {number} The code point to insert on a decoding error.
|
||||
*/
|
||||
function decoderError(fatal, opt_code_point) {
|
||||
if (fatal) {
|
||||
throw new EncodingError('Decoder error');
|
||||
}
|
||||
return opt_code_point || 0xFFFD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} code_point The code point that could not be encoded.
|
||||
*/
|
||||
function encoderError(code_point) {
|
||||
throw new EncodingError('The code point ' + code_point +
|
||||
' could not be encoded.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} label The encoding label.
|
||||
* @return {?{name:string,labels:Array.<string>}}
|
||||
*/
|
||||
function getEncoding(label) {
|
||||
label = String(label).trim().toLowerCase();
|
||||
if (Object.prototype.hasOwnProperty.call(label_to_encoding, label)) {
|
||||
return label_to_encoding[label];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @type {Array.<{encodings: Array.<{name:string,labels:Array.<string>}>,
|
||||
* heading: string}>} */
|
||||
var encodings = [
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"unicode-1-1-utf-8",
|
||||
"utf-8",
|
||||
"utf8"
|
||||
],
|
||||
"name": "utf-8"
|
||||
}
|
||||
],
|
||||
"heading": "The Encoding"
|
||||
},
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"864",
|
||||
"cp864",
|
||||
"csibm864",
|
||||
"ibm864"
|
||||
],
|
||||
"name": "ibm864"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"866",
|
||||
"cp866",
|
||||
"csibm866",
|
||||
"ibm866"
|
||||
],
|
||||
"name": "ibm866"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatin2",
|
||||
"iso-8859-2",
|
||||
"iso-ir-101",
|
||||
"iso8859-2",
|
||||
"iso88592",
|
||||
"iso_8859-2",
|
||||
"iso_8859-2:1987",
|
||||
"l2",
|
||||
"latin2"
|
||||
],
|
||||
"name": "iso-8859-2"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatin3",
|
||||
"iso-8859-3",
|
||||
"iso-ir-109",
|
||||
"iso8859-3",
|
||||
"iso88593",
|
||||
"iso_8859-3",
|
||||
"iso_8859-3:1988",
|
||||
"l3",
|
||||
"latin3"
|
||||
],
|
||||
"name": "iso-8859-3"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatin4",
|
||||
"iso-8859-4",
|
||||
"iso-ir-110",
|
||||
"iso8859-4",
|
||||
"iso88594",
|
||||
"iso_8859-4",
|
||||
"iso_8859-4:1988",
|
||||
"l4",
|
||||
"latin4"
|
||||
],
|
||||
"name": "iso-8859-4"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatincyrillic",
|
||||
"cyrillic",
|
||||
"iso-8859-5",
|
||||
"iso-ir-144",
|
||||
"iso8859-5",
|
||||
"iso88595",
|
||||
"iso_8859-5",
|
||||
"iso_8859-5:1988"
|
||||
],
|
||||
"name": "iso-8859-5"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"arabic",
|
||||
"asmo-708",
|
||||
"csiso88596e",
|
||||
"csiso88596i",
|
||||
"csisolatinarabic",
|
||||
"ecma-114",
|
||||
"iso-8859-6",
|
||||
"iso-8859-6-e",
|
||||
"iso-8859-6-i",
|
||||
"iso-ir-127",
|
||||
"iso8859-6",
|
||||
"iso88596",
|
||||
"iso_8859-6",
|
||||
"iso_8859-6:1987"
|
||||
],
|
||||
"name": "iso-8859-6"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatingreek",
|
||||
"ecma-118",
|
||||
"elot_928",
|
||||
"greek",
|
||||
"greek8",
|
||||
"iso-8859-7",
|
||||
"iso-ir-126",
|
||||
"iso8859-7",
|
||||
"iso88597",
|
||||
"iso_8859-7",
|
||||
"iso_8859-7:1987",
|
||||
"sun_eu_greek"
|
||||
],
|
||||
"name": "iso-8859-7"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csiso88598e",
|
||||
"csisolatinhebrew",
|
||||
"hebrew",
|
||||
"iso-8859-8",
|
||||
"iso-8859-8-e",
|
||||
"iso-ir-138",
|
||||
"iso8859-8",
|
||||
"iso88598",
|
||||
"iso_8859-8",
|
||||
"iso_8859-8:1988",
|
||||
"visual"
|
||||
],
|
||||
"name": "iso-8859-8"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csiso88598i",
|
||||
"iso-8859-8-i",
|
||||
"logical"
|
||||
],
|
||||
"name": "iso-8859-8-i"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatin6",
|
||||
"iso-8859-10",
|
||||
"iso-ir-157",
|
||||
"iso8859-10",
|
||||
"iso885910",
|
||||
"l6",
|
||||
"latin6"
|
||||
],
|
||||
"name": "iso-8859-10"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"iso-8859-13",
|
||||
"iso8859-13",
|
||||
"iso885913"
|
||||
],
|
||||
"name": "iso-8859-13"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"iso-8859-14",
|
||||
"iso8859-14",
|
||||
"iso885914"
|
||||
],
|
||||
"name": "iso-8859-14"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csisolatin9",
|
||||
"iso-8859-15",
|
||||
"iso8859-15",
|
||||
"iso885915",
|
||||
"iso_8859-15",
|
||||
"l9"
|
||||
],
|
||||
"name": "iso-8859-15"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"iso-8859-16"
|
||||
],
|
||||
"name": "iso-8859-16"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cskoi8r",
|
||||
"koi",
|
||||
"koi8",
|
||||
"koi8-r",
|
||||
"koi8_r"
|
||||
],
|
||||
"name": "koi8-r"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"koi8-u"
|
||||
],
|
||||
"name": "koi8-u"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csmacintosh",
|
||||
"mac",
|
||||
"macintosh",
|
||||
"x-mac-roman"
|
||||
],
|
||||
"name": "macintosh"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"dos-874",
|
||||
"iso-8859-11",
|
||||
"iso8859-11",
|
||||
"iso885911",
|
||||
"tis-620",
|
||||
"windows-874"
|
||||
],
|
||||
"name": "windows-874"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1250",
|
||||
"windows-1250",
|
||||
"x-cp1250"
|
||||
],
|
||||
"name": "windows-1250"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1251",
|
||||
"windows-1251",
|
||||
"x-cp1251"
|
||||
],
|
||||
"name": "windows-1251"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"ansi_x3.4-1968",
|
||||
"ascii",
|
||||
"cp1252",
|
||||
"cp819",
|
||||
"csisolatin1",
|
||||
"ibm819",
|
||||
"iso-8859-1",
|
||||
"iso-ir-100",
|
||||
"iso8859-1",
|
||||
"iso88591",
|
||||
"iso_8859-1",
|
||||
"iso_8859-1:1987",
|
||||
"l1",
|
||||
"latin1",
|
||||
"us-ascii",
|
||||
"windows-1252",
|
||||
"x-cp1252"
|
||||
],
|
||||
"name": "windows-1252"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1253",
|
||||
"windows-1253",
|
||||
"x-cp1253"
|
||||
],
|
||||
"name": "windows-1253"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1254",
|
||||
"csisolatin5",
|
||||
"iso-8859-9",
|
||||
"iso-ir-148",
|
||||
"iso8859-9",
|
||||
"iso88599",
|
||||
"iso_8859-9",
|
||||
"iso_8859-9:1989",
|
||||
"l5",
|
||||
"latin5",
|
||||
"windows-1254",
|
||||
"x-cp1254"
|
||||
],
|
||||
"name": "windows-1254"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1255",
|
||||
"windows-1255",
|
||||
"x-cp1255"
|
||||
],
|
||||
"name": "windows-1255"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1256",
|
||||
"windows-1256",
|
||||
"x-cp1256"
|
||||
],
|
||||
"name": "windows-1256"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1257",
|
||||
"windows-1257",
|
||||
"x-cp1257"
|
||||
],
|
||||
"name": "windows-1257"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"cp1258",
|
||||
"windows-1258",
|
||||
"x-cp1258"
|
||||
],
|
||||
"name": "windows-1258"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"x-mac-cyrillic",
|
||||
"x-mac-ukrainian"
|
||||
],
|
||||
"name": "x-mac-cyrillic"
|
||||
}
|
||||
],
|
||||
"heading": "Legacy single-byte encodings"
|
||||
},
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"chinese",
|
||||
"csgb2312",
|
||||
"csiso58gb231280",
|
||||
"gb2312",
|
||||
"gb_2312",
|
||||
"gb_2312-80",
|
||||
"gbk",
|
||||
"iso-ir-58",
|
||||
"x-gbk"
|
||||
],
|
||||
"name": "gbk"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"gb18030"
|
||||
],
|
||||
"name": "gb18030"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"hz-gb-2312"
|
||||
],
|
||||
"name": "hz-gb-2312"
|
||||
}
|
||||
],
|
||||
"heading": "Legacy multi-byte Chinese (simplified) encodings"
|
||||
},
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"big5",
|
||||
"big5-hkscs",
|
||||
"cn-big5",
|
||||
"csbig5",
|
||||
"x-x-big5"
|
||||
],
|
||||
"name": "big5"
|
||||
}
|
||||
],
|
||||
"heading": "Legacy multi-byte Chinese (traditional) encodings"
|
||||
},
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"cseucpkdfmtjapanese",
|
||||
"euc-jp",
|
||||
"x-euc-jp"
|
||||
],
|
||||
"name": "euc-jp"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csiso2022jp",
|
||||
"iso-2022-jp"
|
||||
],
|
||||
"name": "iso-2022-jp"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"csshiftjis",
|
||||
"ms_kanji",
|
||||
"shift-jis",
|
||||
"shift_jis",
|
||||
"sjis",
|
||||
"windows-31j",
|
||||
"x-sjis"
|
||||
],
|
||||
"name": "shift_jis"
|
||||
}
|
||||
],
|
||||
"heading": "Legacy multi-byte Japanese encodings"
|
||||
},
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"cseuckr",
|
||||
"csksc56011987",
|
||||
"euc-kr",
|
||||
"iso-ir-149",
|
||||
"korean",
|
||||
"ks_c_5601-1987",
|
||||
"ks_c_5601-1989",
|
||||
"ksc5601",
|
||||
"ksc_5601",
|
||||
"windows-949"
|
||||
],
|
||||
"name": "euc-kr"
|
||||
}
|
||||
],
|
||||
"heading": "Legacy multi-byte Korean encodings"
|
||||
},
|
||||
{
|
||||
"encodings": [
|
||||
{
|
||||
"labels": [
|
||||
"csiso2022kr",
|
||||
"iso-2022-kr",
|
||||
"iso-2022-cn",
|
||||
"iso-2022-cn-ext"
|
||||
],
|
||||
"name": "replacement"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"utf-16be"
|
||||
],
|
||||
"name": "utf-16be"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"utf-16",
|
||||
"utf-16le"
|
||||
],
|
||||
"name": "utf-16le"
|
||||
},
|
||||
{
|
||||
"labels": [
|
||||
"x-user-defined"
|
||||
],
|
||||
"name": "x-user-defined"
|
||||
}
|
||||
],
|
||||
"heading": "Legacy miscellaneous encodings"
|
||||
}
|
||||
];
|
||||
|
||||
var name_to_encoding = {};
|
||||
var label_to_encoding = {};
|
||||
encodings.forEach(function(category) {
|
||||
category.encodings.forEach(function(encoding) {
|
||||
name_to_encoding[encoding.name] = encoding;
|
||||
encoding.labels.forEach(function(label) {
|
||||
label_to_encoding[label] = encoding;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
// 5. Indexes
|
||||
//
|
||||
|
||||
/**
|
||||
* @param {number} pointer The |pointer| to search for.
|
||||
* @param {Array.<?number>} index The |index| to search within.
|
||||
* @return {?number} The code point corresponding to |pointer| in |index|,
|
||||
* or null if |code point| is not in |index|.
|
||||
*/
|
||||
function indexCodePointFor(pointer, index) {
|
||||
return (index || [])[pointer] || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} code_point The |code point| to search for.
|
||||
* @param {Array.<?number>} index The |index| to search within.
|
||||
* @return {?number} The first pointer corresponding to |code point| in
|
||||
* |index|, or null if |code point| is not in |index|.
|
||||
*/
|
||||
function indexPointerFor(code_point, index) {
|
||||
var pointer = index.indexOf(code_point);
|
||||
return pointer === -1 ? null : pointer;
|
||||
}
|
||||
|
||||
/** @type {Object.<string, (Array.<number>|Array.<Array.<number>>)>} */
|
||||
var indexes = require('./encoding-indexes');
|
||||
|
||||
/**
|
||||
* @param {number} pointer The |pointer| to search for in the gb18030 index.
|
||||
* @return {?number} The code point corresponding to |pointer| in |index|,
|
||||
* or null if |code point| is not in the gb18030 index.
|
||||
*/
|
||||
function indexGB18030CodePointFor(pointer) {
|
||||
if ((pointer > 39419 && pointer < 189000) || (pointer > 1237575)) {
|
||||
return null;
|
||||
}
|
||||
var /** @type {number} */ offset = 0,
|
||||
/** @type {number} */ code_point_offset = 0,
|
||||
/** @type {Array.<Array.<number>>} */ index = indexes['gb18030'];
|
||||
var i;
|
||||
for (i = 0; i < index.length; ++i) {
|
||||
var entry = index[i];
|
||||
if (entry[0] <= pointer) {
|
||||
offset = entry[0];
|
||||
code_point_offset = entry[1];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return code_point_offset + pointer - offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} code_point The |code point| to locate in the gb18030 index.
|
||||
* @return {number} The first pointer corresponding to |code point| in the
|
||||
* gb18030 index.
|
||||
*/
|
||||
function indexGB18030PointerFor(code_point) {
|
||||
var /** @type {number} */ offset = 0,
|
||||
/** @type {number} */ pointer_offset = 0,
|
||||
/** @type {Array.<Array.<number>>} */ index = indexes['gb18030'];
|
||||
var i;
|
||||
for (i = 0; i < index.length; ++i) {
|
||||
var entry = index[i];
|
||||
if (entry[1] <= code_point) {
|
||||
offset = entry[1];
|
||||
pointer_offset = entry[0];
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pointer_offset + code_point - offset;
|
||||
}
|
||||
|
||||
//
|
||||
// 7. The encoding
|
||||
//
|
||||
|
||||
// 7.1 utf-8
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function UTF8Decoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {number} */ utf8_code_point = 0,
|
||||
/** @type {number} */ utf8_bytes_needed = 0,
|
||||
/** @type {number} */ utf8_bytes_seen = 0,
|
||||
/** @type {number} */ utf8_lower_boundary = 0;
|
||||
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte) {
|
||||
if (utf8_bytes_needed !== 0) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return EOF_code_point;
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
|
||||
if (utf8_bytes_needed === 0) {
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
if (inRange(bite, 0xC2, 0xDF)) {
|
||||
utf8_bytes_needed = 1;
|
||||
utf8_lower_boundary = 0x80;
|
||||
utf8_code_point = bite - 0xC0;
|
||||
} else if (inRange(bite, 0xE0, 0xEF)) {
|
||||
utf8_bytes_needed = 2;
|
||||
utf8_lower_boundary = 0x800;
|
||||
utf8_code_point = bite - 0xE0;
|
||||
} else if (inRange(bite, 0xF0, 0xF4)) {
|
||||
utf8_bytes_needed = 3;
|
||||
utf8_lower_boundary = 0x10000;
|
||||
utf8_code_point = bite - 0xF0;
|
||||
} else {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
utf8_code_point = utf8_code_point * Math.pow(64, utf8_bytes_needed);
|
||||
return null;
|
||||
}
|
||||
if (!inRange(bite, 0x80, 0xBF)) {
|
||||
utf8_code_point = 0;
|
||||
utf8_bytes_needed = 0;
|
||||
utf8_bytes_seen = 0;
|
||||
utf8_lower_boundary = 0;
|
||||
byte_pointer.offset(-1);
|
||||
return decoderError(fatal);
|
||||
}
|
||||
utf8_bytes_seen += 1;
|
||||
utf8_code_point = utf8_code_point + (bite - 0x80) *
|
||||
Math.pow(64, utf8_bytes_needed - utf8_bytes_seen);
|
||||
if (utf8_bytes_seen !== utf8_bytes_needed) {
|
||||
return null;
|
||||
}
|
||||
var code_point = utf8_code_point;
|
||||
var lower_boundary = utf8_lower_boundary;
|
||||
utf8_code_point = 0;
|
||||
utf8_bytes_needed = 0;
|
||||
utf8_bytes_seen = 0;
|
||||
utf8_lower_boundary = 0;
|
||||
if (inRange(code_point, lower_boundary, 0x10FFFF) &&
|
||||
!inRange(code_point, 0xD800, 0xDFFF)) {
|
||||
return code_point;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function UTF8Encoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0xD800, 0xDFFF)) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
if (inRange(code_point, 0x0000, 0x007f)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
var count, offset;
|
||||
if (inRange(code_point, 0x0080, 0x07FF)) {
|
||||
count = 1;
|
||||
offset = 0xC0;
|
||||
} else if (inRange(code_point, 0x0800, 0xFFFF)) {
|
||||
count = 2;
|
||||
offset = 0xE0;
|
||||
} else if (inRange(code_point, 0x10000, 0x10FFFF)) {
|
||||
count = 3;
|
||||
offset = 0xF0;
|
||||
}
|
||||
var result = output_byte_stream.emit(
|
||||
div(code_point, Math.pow(64, count)) + offset);
|
||||
while (count > 0) {
|
||||
var temp = div(code_point, Math.pow(64, count - 1));
|
||||
result = output_byte_stream.emit(0x80 + (temp % 64));
|
||||
count -= 1;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['utf-8'].getEncoder = function(options) {
|
||||
return new UTF8Encoder(options);
|
||||
};
|
||||
name_to_encoding['utf-8'].getDecoder = function(options) {
|
||||
return new UTF8Decoder(options);
|
||||
};
|
||||
|
||||
//
|
||||
// 8. Legacy single-byte encodings
|
||||
//
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array.<number>} index The encoding index.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function SingleByteDecoder(index, options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
var code_point = index[bite - 0x80];
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Array.<?number>} index The encoding index.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function SingleByteEncoder(index, options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, index);
|
||||
if (pointer === null) {
|
||||
encoderError(code_point);
|
||||
}
|
||||
return output_byte_stream.emit(pointer + 0x80);
|
||||
};
|
||||
}
|
||||
|
||||
(function() {
|
||||
encodings.forEach(function(category) {
|
||||
if (category.heading !== 'Legacy single-byte encodings')
|
||||
return;
|
||||
category.encodings.forEach(function(encoding) {
|
||||
var index = indexes[encoding.name];
|
||||
encoding.getDecoder = function(options) {
|
||||
return new SingleByteDecoder(index, options);
|
||||
};
|
||||
encoding.getEncoder = function(options) {
|
||||
return new SingleByteEncoder(index, options);
|
||||
};
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
//
|
||||
// 9. Legacy multi-byte Chinese (simplified) encodings
|
||||
//
|
||||
|
||||
// 9.1 gbk
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {boolean} gb18030 True if decoding gb18030, false otherwise.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function GBKDecoder(gb18030, options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {number} */ gbk_first = 0x00,
|
||||
/** @type {number} */ gbk_second = 0x00,
|
||||
/** @type {number} */ gbk_third = 0x00;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte && gbk_first === 0x00 &&
|
||||
gbk_second === 0x00 && gbk_third === 0x00) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
if (bite === EOF_byte &&
|
||||
(gbk_first !== 0x00 || gbk_second !== 0x00 || gbk_third !== 0x00)) {
|
||||
gbk_first = 0x00;
|
||||
gbk_second = 0x00;
|
||||
gbk_third = 0x00;
|
||||
decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
var code_point;
|
||||
if (gbk_third !== 0x00) {
|
||||
code_point = null;
|
||||
if (inRange(bite, 0x30, 0x39)) {
|
||||
code_point = indexGB18030CodePointFor(
|
||||
(((gbk_first - 0x81) * 10 + (gbk_second - 0x30)) * 126 +
|
||||
(gbk_third - 0x81)) * 10 + bite - 0x30);
|
||||
}
|
||||
gbk_first = 0x00;
|
||||
gbk_second = 0x00;
|
||||
gbk_third = 0x00;
|
||||
if (code_point === null) {
|
||||
byte_pointer.offset(-3);
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
if (gbk_second !== 0x00) {
|
||||
if (inRange(bite, 0x81, 0xFE)) {
|
||||
gbk_third = bite;
|
||||
return null;
|
||||
}
|
||||
byte_pointer.offset(-2);
|
||||
gbk_first = 0x00;
|
||||
gbk_second = 0x00;
|
||||
return decoderError(fatal);
|
||||
}
|
||||
if (gbk_first !== 0x00) {
|
||||
if (inRange(bite, 0x30, 0x39) && gb18030) {
|
||||
gbk_second = bite;
|
||||
return null;
|
||||
}
|
||||
var lead = gbk_first;
|
||||
var pointer = null;
|
||||
gbk_first = 0x00;
|
||||
var offset = bite < 0x7F ? 0x40 : 0x41;
|
||||
if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE)) {
|
||||
pointer = (lead - 0x81) * 190 + (bite - offset);
|
||||
}
|
||||
code_point = pointer === null ? null :
|
||||
indexCodePointFor(pointer, indexes['gbk']);
|
||||
if (pointer === null) {
|
||||
byte_pointer.offset(-1);
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
if (bite === 0x80) {
|
||||
return 0x20AC;
|
||||
}
|
||||
if (inRange(bite, 0x81, 0xFE)) {
|
||||
gbk_first = bite;
|
||||
return null;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {boolean} gb18030 True if decoding gb18030, false otherwise.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function GBKEncoder(gb18030, options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, indexes['gbk']);
|
||||
if (pointer !== null) {
|
||||
var lead = div(pointer, 190) + 0x81;
|
||||
var trail = pointer % 190;
|
||||
var offset = trail < 0x3F ? 0x40 : 0x41;
|
||||
return output_byte_stream.emit(lead, trail + offset);
|
||||
}
|
||||
if (pointer === null && !gb18030) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
pointer = indexGB18030PointerFor(code_point);
|
||||
var byte1 = div(div(div(pointer, 10), 126), 10);
|
||||
pointer = pointer - byte1 * 10 * 126 * 10;
|
||||
var byte2 = div(div(pointer, 10), 126);
|
||||
pointer = pointer - byte2 * 10 * 126;
|
||||
var byte3 = div(pointer, 10);
|
||||
var byte4 = pointer - byte3 * 10;
|
||||
return output_byte_stream.emit(byte1 + 0x81,
|
||||
byte2 + 0x30,
|
||||
byte3 + 0x81,
|
||||
byte4 + 0x30);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['gbk'].getEncoder = function(options) {
|
||||
return new GBKEncoder(false, options);
|
||||
};
|
||||
name_to_encoding['gbk'].getDecoder = function(options) {
|
||||
return new GBKDecoder(false, options);
|
||||
};
|
||||
|
||||
// 9.2 gb18030
|
||||
name_to_encoding['gb18030'].getEncoder = function(options) {
|
||||
return new GBKEncoder(true, options);
|
||||
};
|
||||
name_to_encoding['gb18030'].getDecoder = function(options) {
|
||||
return new GBKDecoder(true, options);
|
||||
};
|
||||
|
||||
// 9.3 hz-gb-2312
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function HZGB2312Decoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {boolean} */ hzgb2312 = false,
|
||||
/** @type {number} */ hzgb2312_lead = 0x00;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte && hzgb2312_lead === 0x00) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
if (bite === EOF_byte && hzgb2312_lead !== 0x00) {
|
||||
hzgb2312_lead = 0x00;
|
||||
return decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
if (hzgb2312_lead === 0x7E) {
|
||||
hzgb2312_lead = 0x00;
|
||||
if (bite === 0x7B) {
|
||||
hzgb2312 = true;
|
||||
return null;
|
||||
}
|
||||
if (bite === 0x7D) {
|
||||
hzgb2312 = false;
|
||||
return null;
|
||||
}
|
||||
if (bite === 0x7E) {
|
||||
return 0x007E;
|
||||
}
|
||||
if (bite === 0x0A) {
|
||||
return null;
|
||||
}
|
||||
byte_pointer.offset(-1);
|
||||
return decoderError(fatal);
|
||||
}
|
||||
if (hzgb2312_lead !== 0x00) {
|
||||
var lead = hzgb2312_lead;
|
||||
hzgb2312_lead = 0x00;
|
||||
var code_point = null;
|
||||
if (inRange(bite, 0x21, 0x7E)) {
|
||||
code_point = indexCodePointFor((lead - 1) * 190 +
|
||||
(bite + 0x3F), indexes['gbk']);
|
||||
}
|
||||
if (bite === 0x0A) {
|
||||
hzgb2312 = false;
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
if (bite === 0x7E) {
|
||||
hzgb2312_lead = 0x7E;
|
||||
return null;
|
||||
}
|
||||
if (hzgb2312) {
|
||||
if (inRange(bite, 0x20, 0x7F)) {
|
||||
hzgb2312_lead = bite;
|
||||
return null;
|
||||
}
|
||||
if (bite === 0x0A) {
|
||||
hzgb2312 = false;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
}
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function HZGB2312Encoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var hzgb2312 = false;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x007F) && hzgb2312) {
|
||||
code_point_pointer.offset(-1);
|
||||
hzgb2312 = false;
|
||||
return output_byte_stream.emit(0x7E, 0x7D);
|
||||
}
|
||||
if (code_point === 0x007E) {
|
||||
return output_byte_stream.emit(0x7E, 0x7E);
|
||||
}
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
if (!hzgb2312) {
|
||||
code_point_pointer.offset(-1);
|
||||
hzgb2312 = true;
|
||||
return output_byte_stream.emit(0x7E, 0x7B);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, indexes['gbk']);
|
||||
if (pointer === null) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
var lead = div(pointer, 190) + 1;
|
||||
var trail = pointer % 190 - 0x3F;
|
||||
if (!inRange(lead, 0x21, 0x7E) || !inRange(trail, 0x21, 0x7E)) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
return output_byte_stream.emit(lead, trail);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['hz-gb-2312'].getEncoder = function(options) {
|
||||
return new HZGB2312Encoder(options);
|
||||
};
|
||||
name_to_encoding['hz-gb-2312'].getDecoder = function(options) {
|
||||
return new HZGB2312Decoder(options);
|
||||
};
|
||||
|
||||
//
|
||||
// 10. Legacy multi-byte Chinese (traditional) encodings
|
||||
//
|
||||
|
||||
// 10.1 big5
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function Big5Decoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {number} */ big5_lead = 0x00,
|
||||
/** @type {?number} */ big5_pending = null;
|
||||
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte steram to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
// NOTE: Hack to support emitting two code points
|
||||
if (big5_pending !== null) {
|
||||
var pending = big5_pending;
|
||||
big5_pending = null;
|
||||
return pending;
|
||||
}
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte && big5_lead === 0x00) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
if (bite === EOF_byte && big5_lead !== 0x00) {
|
||||
big5_lead = 0x00;
|
||||
return decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
if (big5_lead !== 0x00) {
|
||||
var lead = big5_lead;
|
||||
var pointer = null;
|
||||
big5_lead = 0x00;
|
||||
var offset = bite < 0x7F ? 0x40 : 0x62;
|
||||
if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE)) {
|
||||
pointer = (lead - 0x81) * 157 + (bite - offset);
|
||||
}
|
||||
if (pointer === 1133) {
|
||||
big5_pending = 0x0304;
|
||||
return 0x00CA;
|
||||
}
|
||||
if (pointer === 1135) {
|
||||
big5_pending = 0x030C;
|
||||
return 0x00CA;
|
||||
}
|
||||
if (pointer === 1164) {
|
||||
big5_pending = 0x0304;
|
||||
return 0x00EA;
|
||||
}
|
||||
if (pointer === 1166) {
|
||||
big5_pending = 0x030C;
|
||||
return 0x00EA;
|
||||
}
|
||||
var code_point = (pointer === null) ? null :
|
||||
indexCodePointFor(pointer, indexes['big5']);
|
||||
if (pointer === null) {
|
||||
byte_pointer.offset(-1);
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
if (inRange(bite, 0x81, 0xFE)) {
|
||||
big5_lead = bite;
|
||||
return null;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function Big5Encoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, indexes['big5']);
|
||||
if (pointer === null) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
var lead = div(pointer, 157) + 0x81;
|
||||
//if (lead < 0xA1) {
|
||||
// return encoderError(code_point);
|
||||
//}
|
||||
var trail = pointer % 157;
|
||||
var offset = trail < 0x3F ? 0x40 : 0x62;
|
||||
return output_byte_stream.emit(lead, trail + offset);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['big5'].getEncoder = function(options) {
|
||||
return new Big5Encoder(options);
|
||||
};
|
||||
name_to_encoding['big5'].getDecoder = function(options) {
|
||||
return new Big5Decoder(options);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 11. Legacy multi-byte Japanese encodings
|
||||
//
|
||||
|
||||
// 11.1 euc.jp
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function EUCJPDecoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {number} */ eucjp_first = 0x00,
|
||||
/** @type {number} */ eucjp_second = 0x00;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte) {
|
||||
if (eucjp_first === 0x00 && eucjp_second === 0x00) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
eucjp_first = 0x00;
|
||||
eucjp_second = 0x00;
|
||||
return decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
|
||||
var lead, code_point;
|
||||
if (eucjp_second !== 0x00) {
|
||||
lead = eucjp_second;
|
||||
eucjp_second = 0x00;
|
||||
code_point = null;
|
||||
if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
|
||||
code_point = indexCodePointFor((lead - 0xA1) * 94 + bite - 0xA1,
|
||||
indexes['jis0212']);
|
||||
}
|
||||
if (!inRange(bite, 0xA1, 0xFE)) {
|
||||
byte_pointer.offset(-1);
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
if (eucjp_first === 0x8E && inRange(bite, 0xA1, 0xDF)) {
|
||||
eucjp_first = 0x00;
|
||||
return 0xFF61 + bite - 0xA1;
|
||||
}
|
||||
if (eucjp_first === 0x8F && inRange(bite, 0xA1, 0xFE)) {
|
||||
eucjp_first = 0x00;
|
||||
eucjp_second = bite;
|
||||
return null;
|
||||
}
|
||||
if (eucjp_first !== 0x00) {
|
||||
lead = eucjp_first;
|
||||
eucjp_first = 0x00;
|
||||
code_point = null;
|
||||
if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
|
||||
code_point = indexCodePointFor((lead - 0xA1) * 94 + bite - 0xA1,
|
||||
indexes['jis0208']);
|
||||
}
|
||||
if (!inRange(bite, 0xA1, 0xFE)) {
|
||||
byte_pointer.offset(-1);
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
if (bite === 0x8E || bite === 0x8F || (inRange(bite, 0xA1, 0xFE))) {
|
||||
eucjp_first = bite;
|
||||
return null;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function EUCJPEncoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
if (code_point === 0x00A5) {
|
||||
return output_byte_stream.emit(0x5C);
|
||||
}
|
||||
if (code_point === 0x203E) {
|
||||
return output_byte_stream.emit(0x7E);
|
||||
}
|
||||
if (inRange(code_point, 0xFF61, 0xFF9F)) {
|
||||
return output_byte_stream.emit(0x8E, code_point - 0xFF61 + 0xA1);
|
||||
}
|
||||
|
||||
var pointer = indexPointerFor(code_point, indexes['jis0208']);
|
||||
if (pointer === null) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
var lead = div(pointer, 94) + 0xA1;
|
||||
var trail = pointer % 94 + 0xA1;
|
||||
return output_byte_stream.emit(lead, trail);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['euc-jp'].getEncoder = function(options) {
|
||||
return new EUCJPEncoder(options);
|
||||
};
|
||||
name_to_encoding['euc-jp'].getDecoder = function(options) {
|
||||
return new EUCJPDecoder(options);
|
||||
};
|
||||
|
||||
// 11.2 iso-2022-jp
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function ISO2022JPDecoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/** @enum */
|
||||
var state = {
|
||||
ASCII: 0,
|
||||
escape_start: 1,
|
||||
escape_middle: 2,
|
||||
escape_final: 3,
|
||||
lead: 4,
|
||||
trail: 5,
|
||||
Katakana: 6
|
||||
};
|
||||
var /** @type {number} */ iso2022jp_state = state.ASCII,
|
||||
/** @type {boolean} */ iso2022jp_jis0212 = false,
|
||||
/** @type {number} */ iso2022jp_lead = 0x00;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite !== EOF_byte) {
|
||||
byte_pointer.offset(1);
|
||||
}
|
||||
switch (iso2022jp_state) {
|
||||
default:
|
||||
case state.ASCII:
|
||||
if (bite === 0x1B) {
|
||||
iso2022jp_state = state.escape_start;
|
||||
return null;
|
||||
}
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
if (bite === EOF_byte) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
|
||||
case state.escape_start:
|
||||
if (bite === 0x24 || bite === 0x28) {
|
||||
iso2022jp_lead = bite;
|
||||
iso2022jp_state = state.escape_middle;
|
||||
return null;
|
||||
}
|
||||
if (bite !== EOF_byte) {
|
||||
byte_pointer.offset(-1);
|
||||
}
|
||||
iso2022jp_state = state.ASCII;
|
||||
return decoderError(fatal);
|
||||
|
||||
case state.escape_middle:
|
||||
var lead = iso2022jp_lead;
|
||||
iso2022jp_lead = 0x00;
|
||||
if (lead === 0x24 && (bite === 0x40 || bite === 0x42)) {
|
||||
iso2022jp_jis0212 = false;
|
||||
iso2022jp_state = state.lead;
|
||||
return null;
|
||||
}
|
||||
if (lead === 0x24 && bite === 0x28) {
|
||||
iso2022jp_state = state.escape_final;
|
||||
return null;
|
||||
}
|
||||
if (lead === 0x28 && (bite === 0x42 || bite === 0x4A)) {
|
||||
iso2022jp_state = state.ASCII;
|
||||
return null;
|
||||
}
|
||||
if (lead === 0x28 && bite === 0x49) {
|
||||
iso2022jp_state = state.Katakana;
|
||||
return null;
|
||||
}
|
||||
if (bite === EOF_byte) {
|
||||
byte_pointer.offset(-1);
|
||||
} else {
|
||||
byte_pointer.offset(-2);
|
||||
}
|
||||
iso2022jp_state = state.ASCII;
|
||||
return decoderError(fatal);
|
||||
|
||||
case state.escape_final:
|
||||
if (bite === 0x44) {
|
||||
iso2022jp_jis0212 = true;
|
||||
iso2022jp_state = state.lead;
|
||||
return null;
|
||||
}
|
||||
if (bite === EOF_byte) {
|
||||
byte_pointer.offset(-2);
|
||||
} else {
|
||||
byte_pointer.offset(-3);
|
||||
}
|
||||
iso2022jp_state = state.ASCII;
|
||||
return decoderError(fatal);
|
||||
|
||||
case state.lead:
|
||||
if (bite === 0x0A) {
|
||||
iso2022jp_state = state.ASCII;
|
||||
return decoderError(fatal, 0x000A);
|
||||
}
|
||||
if (bite === 0x1B) {
|
||||
iso2022jp_state = state.escape_start;
|
||||
return null;
|
||||
}
|
||||
if (bite === EOF_byte) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
iso2022jp_lead = bite;
|
||||
iso2022jp_state = state.trail;
|
||||
return null;
|
||||
|
||||
case state.trail:
|
||||
iso2022jp_state = state.lead;
|
||||
if (bite === EOF_byte) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
var code_point = null;
|
||||
var pointer = (iso2022jp_lead - 0x21) * 94 + bite - 0x21;
|
||||
if (inRange(iso2022jp_lead, 0x21, 0x7E) &&
|
||||
inRange(bite, 0x21, 0x7E)) {
|
||||
code_point = (iso2022jp_jis0212 === false) ?
|
||||
indexCodePointFor(pointer, indexes['jis0208']) :
|
||||
indexCodePointFor(pointer, indexes['jis0212']);
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
|
||||
case state.Katakana:
|
||||
if (bite === 0x1B) {
|
||||
iso2022jp_state = state.escape_start;
|
||||
return null;
|
||||
}
|
||||
if (inRange(bite, 0x21, 0x5F)) {
|
||||
return 0xFF61 + bite - 0x21;
|
||||
}
|
||||
if (bite === EOF_byte) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function ISO2022JPEncoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/** @enum */
|
||||
var state = {
|
||||
ASCII: 0,
|
||||
lead: 1,
|
||||
Katakana: 2
|
||||
};
|
||||
var /** @type {number} */ iso2022jp_state = state.ASCII;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if ((inRange(code_point, 0x0000, 0x007F) ||
|
||||
code_point === 0x00A5 || code_point === 0x203E) &&
|
||||
iso2022jp_state !== state.ASCII) {
|
||||
code_point_pointer.offset(-1);
|
||||
iso2022jp_state = state.ASCII;
|
||||
return output_byte_stream.emit(0x1B, 0x28, 0x42);
|
||||
}
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
if (code_point === 0x00A5) {
|
||||
return output_byte_stream.emit(0x5C);
|
||||
}
|
||||
if (code_point === 0x203E) {
|
||||
return output_byte_stream.emit(0x7E);
|
||||
}
|
||||
if (inRange(code_point, 0xFF61, 0xFF9F) &&
|
||||
iso2022jp_state !== state.Katakana) {
|
||||
code_point_pointer.offset(-1);
|
||||
iso2022jp_state = state.Katakana;
|
||||
return output_byte_stream.emit(0x1B, 0x28, 0x49);
|
||||
}
|
||||
if (inRange(code_point, 0xFF61, 0xFF9F)) {
|
||||
return output_byte_stream.emit(code_point - 0xFF61 - 0x21);
|
||||
}
|
||||
if (iso2022jp_state !== state.lead) {
|
||||
code_point_pointer.offset(-1);
|
||||
iso2022jp_state = state.lead;
|
||||
return output_byte_stream.emit(0x1B, 0x24, 0x42);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, indexes['jis0208']);
|
||||
if (pointer === null) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
var lead = div(pointer, 94) + 0x21;
|
||||
var trail = pointer % 94 + 0x21;
|
||||
return output_byte_stream.emit(lead, trail);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['iso-2022-jp'].getEncoder = function(options) {
|
||||
return new ISO2022JPEncoder(options);
|
||||
};
|
||||
name_to_encoding['iso-2022-jp'].getDecoder = function(options) {
|
||||
return new ISO2022JPDecoder(options);
|
||||
};
|
||||
|
||||
// 11.3 shift_jis
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function ShiftJISDecoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {number} */ shiftjis_lead = 0x00;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte && shiftjis_lead === 0x00) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
if (bite === EOF_byte && shiftjis_lead !== 0x00) {
|
||||
shiftjis_lead = 0x00;
|
||||
return decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
if (shiftjis_lead !== 0x00) {
|
||||
var lead = shiftjis_lead;
|
||||
shiftjis_lead = 0x00;
|
||||
if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFC)) {
|
||||
var offset = (bite < 0x7F) ? 0x40 : 0x41;
|
||||
var lead_offset = (lead < 0xA0) ? 0x81 : 0xC1;
|
||||
var code_point = indexCodePointFor((lead - lead_offset) * 188 +
|
||||
bite - offset, indexes['jis0208']);
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
byte_pointer.offset(-1);
|
||||
return decoderError(fatal);
|
||||
}
|
||||
if (inRange(bite, 0x00, 0x80)) {
|
||||
return bite;
|
||||
}
|
||||
if (inRange(bite, 0xA1, 0xDF)) {
|
||||
return 0xFF61 + bite - 0xA1;
|
||||
}
|
||||
if (inRange(bite, 0x81, 0x9F) || inRange(bite, 0xE0, 0xFC)) {
|
||||
shiftjis_lead = bite;
|
||||
return null;
|
||||
}
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function ShiftJISEncoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x0080)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
if (code_point === 0x00A5) {
|
||||
return output_byte_stream.emit(0x5C);
|
||||
}
|
||||
if (code_point === 0x203E) {
|
||||
return output_byte_stream.emit(0x7E);
|
||||
}
|
||||
if (inRange(code_point, 0xFF61, 0xFF9F)) {
|
||||
return output_byte_stream.emit(code_point - 0xFF61 + 0xA1);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, indexes['jis0208']);
|
||||
if (pointer === null) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
var lead = div(pointer, 188);
|
||||
var lead_offset = lead < 0x1F ? 0x81 : 0xC1;
|
||||
var trail = pointer % 188;
|
||||
var offset = trail < 0x3F ? 0x40 : 0x41;
|
||||
return output_byte_stream.emit(lead + lead_offset, trail + offset);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['shift_jis'].getEncoder = function(options) {
|
||||
return new ShiftJISEncoder(options);
|
||||
};
|
||||
name_to_encoding['shift_jis'].getDecoder = function(options) {
|
||||
return new ShiftJISDecoder(options);
|
||||
};
|
||||
|
||||
//
|
||||
// 12. Legacy multi-byte Korean encodings
|
||||
//
|
||||
|
||||
// 12.1 euc-kr
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function EUCKRDecoder(options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {number} */ euckr_lead = 0x00;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte && euckr_lead === 0) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
if (bite === EOF_byte && euckr_lead !== 0) {
|
||||
euckr_lead = 0x00;
|
||||
return decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
if (euckr_lead !== 0x00) {
|
||||
var lead = euckr_lead;
|
||||
var pointer = null;
|
||||
euckr_lead = 0x00;
|
||||
|
||||
if (inRange(lead, 0x81, 0xC6)) {
|
||||
var temp = (26 + 26 + 126) * (lead - 0x81);
|
||||
if (inRange(bite, 0x41, 0x5A)) {
|
||||
pointer = temp + bite - 0x41;
|
||||
} else if (inRange(bite, 0x61, 0x7A)) {
|
||||
pointer = temp + 26 + bite - 0x61;
|
||||
} else if (inRange(bite, 0x81, 0xFE)) {
|
||||
pointer = temp + 26 + 26 + bite - 0x81;
|
||||
}
|
||||
}
|
||||
|
||||
if (inRange(lead, 0xC7, 0xFD) && inRange(bite, 0xA1, 0xFE)) {
|
||||
pointer = (26 + 26 + 126) * (0xC7 - 0x81) + (lead - 0xC7) * 94 +
|
||||
(bite - 0xA1);
|
||||
}
|
||||
|
||||
var code_point = (pointer === null) ? null :
|
||||
indexCodePointFor(pointer, indexes['euc-kr']);
|
||||
if (pointer === null) {
|
||||
byte_pointer.offset(-1);
|
||||
}
|
||||
if (code_point === null) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
}
|
||||
|
||||
if (inRange(bite, 0x00, 0x7F)) {
|
||||
return bite;
|
||||
}
|
||||
|
||||
if (inRange(bite, 0x81, 0xFD)) {
|
||||
euckr_lead = bite;
|
||||
return null;
|
||||
}
|
||||
|
||||
return decoderError(fatal);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function EUCKREncoder(options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0x0000, 0x007F)) {
|
||||
return output_byte_stream.emit(code_point);
|
||||
}
|
||||
var pointer = indexPointerFor(code_point, indexes['euc-kr']);
|
||||
if (pointer === null) {
|
||||
return encoderError(code_point);
|
||||
}
|
||||
var lead, trail;
|
||||
if (pointer < ((26 + 26 + 126) * (0xC7 - 0x81))) {
|
||||
lead = div(pointer, (26 + 26 + 126)) + 0x81;
|
||||
trail = pointer % (26 + 26 + 126);
|
||||
var offset = trail < 26 ? 0x41 : trail < 26 + 26 ? 0x47 : 0x4D;
|
||||
return output_byte_stream.emit(lead, trail + offset);
|
||||
}
|
||||
pointer = pointer - (26 + 26 + 126) * (0xC7 - 0x81);
|
||||
lead = div(pointer, 94) + 0xC7;
|
||||
trail = pointer % 94 + 0xA1;
|
||||
return output_byte_stream.emit(lead, trail);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['euc-kr'].getEncoder = function(options) {
|
||||
return new EUCKREncoder(options);
|
||||
};
|
||||
name_to_encoding['euc-kr'].getDecoder = function(options) {
|
||||
return new EUCKRDecoder(options);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 13. Legacy utf-16 encodings
|
||||
//
|
||||
|
||||
// 13.1 utf-16
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {boolean} utf16_be True if big-endian, false if little-endian.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function UTF16Decoder(utf16_be, options) {
|
||||
var fatal = options.fatal;
|
||||
var /** @type {?number} */ utf16_lead_byte = null,
|
||||
/** @type {?number} */ utf16_lead_surrogate = null;
|
||||
/**
|
||||
* @param {ByteInputStream} byte_pointer The byte stream to decode.
|
||||
* @return {?number} The next code point decoded, or null if not enough
|
||||
* data exists in the input stream to decode a complete code point.
|
||||
*/
|
||||
this.decode = function(byte_pointer) {
|
||||
var bite = byte_pointer.get();
|
||||
if (bite === EOF_byte && utf16_lead_byte === null &&
|
||||
utf16_lead_surrogate === null) {
|
||||
return EOF_code_point;
|
||||
}
|
||||
if (bite === EOF_byte && (utf16_lead_byte !== null ||
|
||||
utf16_lead_surrogate !== null)) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
byte_pointer.offset(1);
|
||||
if (utf16_lead_byte === null) {
|
||||
utf16_lead_byte = bite;
|
||||
return null;
|
||||
}
|
||||
var code_point;
|
||||
if (utf16_be) {
|
||||
code_point = (utf16_lead_byte << 8) + bite;
|
||||
} else {
|
||||
code_point = (bite << 8) + utf16_lead_byte;
|
||||
}
|
||||
utf16_lead_byte = null;
|
||||
if (utf16_lead_surrogate !== null) {
|
||||
var lead_surrogate = utf16_lead_surrogate;
|
||||
utf16_lead_surrogate = null;
|
||||
if (inRange(code_point, 0xDC00, 0xDFFF)) {
|
||||
return 0x10000 + (lead_surrogate - 0xD800) * 0x400 +
|
||||
(code_point - 0xDC00);
|
||||
}
|
||||
byte_pointer.offset(-2);
|
||||
return decoderError(fatal);
|
||||
}
|
||||
if (inRange(code_point, 0xD800, 0xDBFF)) {
|
||||
utf16_lead_surrogate = code_point;
|
||||
return null;
|
||||
}
|
||||
if (inRange(code_point, 0xDC00, 0xDFFF)) {
|
||||
return decoderError(fatal);
|
||||
}
|
||||
return code_point;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {boolean} utf16_be True if big-endian, false if little-endian.
|
||||
* @param {{fatal: boolean}} options
|
||||
*/
|
||||
function UTF16Encoder(utf16_be, options) {
|
||||
var fatal = options.fatal;
|
||||
/**
|
||||
* @param {ByteOutputStream} output_byte_stream Output byte stream.
|
||||
* @param {CodePointInputStream} code_point_pointer Input stream.
|
||||
* @return {number} The last byte emitted.
|
||||
*/
|
||||
this.encode = function(output_byte_stream, code_point_pointer) {
|
||||
function convert_to_bytes(code_unit) {
|
||||
var byte1 = code_unit >> 8;
|
||||
var byte2 = code_unit & 0x00FF;
|
||||
if (utf16_be) {
|
||||
return output_byte_stream.emit(byte1, byte2);
|
||||
}
|
||||
return output_byte_stream.emit(byte2, byte1);
|
||||
}
|
||||
var code_point = code_point_pointer.get();
|
||||
if (code_point === EOF_code_point) {
|
||||
return EOF_byte;
|
||||
}
|
||||
code_point_pointer.offset(1);
|
||||
if (inRange(code_point, 0xD800, 0xDFFF)) {
|
||||
encoderError(code_point);
|
||||
}
|
||||
if (code_point <= 0xFFFF) {
|
||||
return convert_to_bytes(code_point);
|
||||
}
|
||||
var lead = div((code_point - 0x10000), 0x400) + 0xD800;
|
||||
var trail = ((code_point - 0x10000) % 0x400) + 0xDC00;
|
||||
convert_to_bytes(lead);
|
||||
return convert_to_bytes(trail);
|
||||
};
|
||||
}
|
||||
|
||||
name_to_encoding['utf-16le'].getEncoder = function(options) {
|
||||
return new UTF16Encoder(false, options);
|
||||
};
|
||||
name_to_encoding['utf-16le'].getDecoder = function(options) {
|
||||
return new UTF16Decoder(false, options);
|
||||
};
|
||||
|
||||
// 13.2 utf-16be
|
||||
name_to_encoding['utf-16be'].getEncoder = function(options) {
|
||||
return new UTF16Encoder(true, options);
|
||||
};
|
||||
name_to_encoding['utf-16be'].getDecoder = function(options) {
|
||||
return new UTF16Decoder(true, options);
|
||||
};
|
||||
|
||||
|
||||
// NOTE: currently unused
|
||||
/**
|
||||
* @param {string} label The encoding label.
|
||||
* @param {ByteInputStream} input_stream The byte stream to test.
|
||||
*/
|
||||
function detectEncoding(label, input_stream) {
|
||||
if (input_stream.match([0xFF, 0xFE])) {
|
||||
input_stream.offset(2);
|
||||
return 'utf-16le';
|
||||
}
|
||||
if (input_stream.match([0xFE, 0xFF])) {
|
||||
input_stream.offset(2);
|
||||
return 'utf-16be';
|
||||
}
|
||||
if (input_stream.match([0xEF, 0xBB, 0xBF])) {
|
||||
input_stream.offset(3);
|
||||
return 'utf-8';
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
//
|
||||
// Implementation of Text Encoding Web API
|
||||
//
|
||||
|
||||
/** @const */ var DEFAULT_ENCODING = 'utf-8';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string=} opt_encoding The label of the encoding;
|
||||
* defaults to 'utf-8'.
|
||||
* @param {{fatal: boolean}=} options
|
||||
*/
|
||||
function TextEncoder(opt_encoding, options) {
|
||||
if (!(this instanceof TextEncoder)) {
|
||||
return new TextEncoder(opt_encoding, options);
|
||||
}
|
||||
opt_encoding = opt_encoding ? String(opt_encoding) : DEFAULT_ENCODING;
|
||||
options = Object(options);
|
||||
/** @private */
|
||||
this._encoding = getEncoding(opt_encoding);
|
||||
if (this._encoding === null || (this._encoding.name !== 'utf-8' &&
|
||||
this._encoding.name !== 'utf-16le' &&
|
||||
this._encoding.name !== 'utf-16be'))
|
||||
throw new TypeError('Unknown encoding: ' + opt_encoding);
|
||||
/** @private @type {boolean} */
|
||||
this._streaming = false;
|
||||
/** @private */
|
||||
this._encoder = null;
|
||||
/** @private @type {{fatal: boolean}=} */
|
||||
this._options = { fatal: Boolean(options.fatal) };
|
||||
|
||||
if (Object.defineProperty) {
|
||||
Object.defineProperty(
|
||||
this, 'encoding',
|
||||
{ get: function() { return this._encoding.name; } });
|
||||
} else {
|
||||
this.encoding = this._encoding.name;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
TextEncoder.prototype = {
|
||||
/**
|
||||
* @param {string=} opt_string The string to encode.
|
||||
* @param {{stream: boolean}=} options
|
||||
*/
|
||||
encode: function encode(opt_string, options) {
|
||||
opt_string = opt_string ? String(opt_string) : '';
|
||||
options = Object(options);
|
||||
// TODO: any options?
|
||||
if (!this._streaming) {
|
||||
this._encoder = this._encoding.getEncoder(this._options);
|
||||
}
|
||||
this._streaming = Boolean(options.stream);
|
||||
|
||||
var bytes = [];
|
||||
var output_stream = new ByteOutputStream(bytes);
|
||||
var input_stream = new CodePointInputStream(opt_string);
|
||||
while (input_stream.get() !== EOF_code_point) {
|
||||
this._encoder.encode(output_stream, input_stream);
|
||||
}
|
||||
if (!this._streaming) {
|
||||
var last_byte;
|
||||
do {
|
||||
last_byte = this._encoder.encode(output_stream, input_stream);
|
||||
} while (last_byte !== EOF_byte);
|
||||
this._encoder = null;
|
||||
}
|
||||
return new Buffer(bytes);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string=} opt_encoding The label of the encoding;
|
||||
* defaults to 'utf-8'.
|
||||
* @param {{fatal: boolean}=} options
|
||||
*/
|
||||
function TextDecoder(opt_encoding, options) {
|
||||
if (!(this instanceof TextDecoder)) {
|
||||
return new TextDecoder(opt_encoding, options);
|
||||
}
|
||||
opt_encoding = opt_encoding ? String(opt_encoding) : DEFAULT_ENCODING;
|
||||
options = Object(options);
|
||||
/** @private */
|
||||
this._encoding = getEncoding(opt_encoding);
|
||||
if (this._encoding === null)
|
||||
throw new TypeError('Unknown encoding: ' + opt_encoding);
|
||||
|
||||
/** @private @type {boolean} */
|
||||
this._streaming = false;
|
||||
/** @private */
|
||||
this._decoder = null;
|
||||
/** @private @type {{fatal: boolean}=} */
|
||||
this._options = { fatal: Boolean(options.fatal) };
|
||||
|
||||
if (Object.defineProperty) {
|
||||
Object.defineProperty(
|
||||
this, 'encoding',
|
||||
{ get: function() { return this._encoding.name; } });
|
||||
} else {
|
||||
this.encoding = this._encoding.name;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Issue if input byte stream is offset by decoder
|
||||
// TODO: BOM detection will not work if stream header spans multiple calls
|
||||
// (last N bytes of previous stream may need to be retained?)
|
||||
TextDecoder.prototype = {
|
||||
/**
|
||||
* @param {Buffer=} buf The buffer of bytes to decode.
|
||||
* @param {{stream: boolean}=} options
|
||||
*/
|
||||
decode: function decode(buf, options) {
|
||||
options = Object(options);
|
||||
|
||||
if (!this._streaming) {
|
||||
this._decoder = this._encoding.getDecoder(this._options);
|
||||
this._BOMseen = false;
|
||||
}
|
||||
this._streaming = Boolean(options.stream);
|
||||
|
||||
var input_stream = new ByteInputStream(buf);
|
||||
|
||||
var output_stream = new CodePointOutputStream(), code_point;
|
||||
while (input_stream.get() !== EOF_byte) {
|
||||
code_point = this._decoder.decode(input_stream);
|
||||
if (code_point !== null && code_point !== EOF_code_point) {
|
||||
output_stream.emit(code_point);
|
||||
}
|
||||
}
|
||||
if (!this._streaming) {
|
||||
do {
|
||||
code_point = this._decoder.decode(input_stream);
|
||||
if (code_point !== null && code_point !== EOF_code_point) {
|
||||
output_stream.emit(code_point);
|
||||
}
|
||||
} while (code_point !== EOF_code_point &&
|
||||
input_stream.get() != EOF_byte);
|
||||
this._decoder = null;
|
||||
}
|
||||
|
||||
var result = output_stream.string();
|
||||
if (!this._BOMseen && result.length) {
|
||||
this._BOMseen = true;
|
||||
if (UTFs.indexOf(this.encoding) !== -1 &&
|
||||
result.charCodeAt(0) === 0xFEFF) {
|
||||
result = result.substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
var UTFs = ['utf-8', 'utf-16le', 'utf-16be'];
|
||||
exports.TextEncoder = TextEncoder;
|
||||
exports.TextDecoder = TextDecoder;
|
||||
exports.encodingExists = getEncoding;
|
||||
Reference in new issue
Block a user