[Pkg-javascript-commits] [node-iconv-lite] 29/83: Generate encodings for several single byte encodings using iconv.
matthew pideil
mpideil-guest at moszumanska.debian.org
Tue Apr 1 19:56:47 UTC 2014
This is an automated email from the git hooks/post-receive script.
mpideil-guest pushed a commit to branch master
in repository node-iconv-lite.
commit d79229495f835bc649ba3f2e6c0e34003175e1dc
Author: Mike D Pilsbury <mike.pilsbury at gmail.com>
Date: Mon May 7 08:03:54 2012 +0100
Generate encodings for several single byte encodings using iconv.
Western, greek, cyrillic, turkish, hebrew, arabic, baltic and vietnamese encodings are generated.
---
encodings/arabic.js | 20 ++++
encodings/baltic.js | 20 ++++
encodings/cyrillic.js | 31 ++----
encodings/greek.js | 11 +-
encodings/hebrew.js | 21 ++++
encodings/turkish.js | 23 +---
encodings/vietnamese.js | 12 ++
encodings/western.js | 47 +++++++-
generation/generate-encoding.js | 241 ++++++++++++++++++++++++++++++++++++++++
9 files changed, 377 insertions(+), 49 deletions(-)
diff --git a/encodings/arabic.js b/encodings/arabic.js
new file mode 100644
index 0000000..07be51e
--- /dev/null
+++ b/encodings/arabic.js
@@ -0,0 +1,20 @@
+// Arabic encodings
+
+module.exports = {
+ "windows1256": {
+ type: "singlebyte",
+ chars: "\u20ac\u067e\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0679\u2039\u0152\u0686\u0698\u0688\u06af\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u06a9\u2122\u0691\u203a\u0153\u200c\u200d\u06ba\u00a0\u060c\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u06be\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u061b\u00bb\u00bc\u00bd\u00be\u061f\u06c1\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u [...]
+ },
+ "win1256": "windows1256",
+ "cp1256": "windows1256",
+ 1256: "windows1256",
+
+ "iso88596": {
+ type: "singlebyte",
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\ufffd\ufffd\ufffd\u00a4\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u060c\u00ad\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u061b\ufffd\ufffd\ufffd\u061f\ufffd\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u [...]
+ },
+ "arabic": "iso88596",
+ "cp28596": "iso88596",
+ 28596: "iso88596",
+
+};
diff --git a/encodings/baltic.js b/encodings/baltic.js
new file mode 100644
index 0000000..4ce025e
--- /dev/null
+++ b/encodings/baltic.js
@@ -0,0 +1,20 @@
+// Estonian, Latvian and Lithuanian encodings
+
+module.exports = {
+ "windows1257": {
+ type: "singlebyte",
+ chars: "\u20ac\ufffd\u201a\ufffd\u201e\u2026\u2020\u2021\ufffd\u2030\ufffd\u2039\ufffd\u00a8\u02c7\u00b8\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\ufffd\u2122\ufffd\u203a\ufffd\u00af\u02db\ufffd\u00a0\ufffd\u00a2\u00a3\u00a4\ufffd\u00a6\u00a7\u00d8\u00a9\u0156\u00ab\u00ac\u00ad\u00ae\u00c6\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00f8\u00b9\u0157\u00bb\u00bc\u00bd\u00be\u00e6\u0104\u012e\u0100\u0106\u00c4\u00c5\u0118\u0112\u010c\u00c9\u0179\u0116\u0122\u0136\u012a\u [...]
+ },
+ "win1257": "windows1257",
+ "cp1257": "windows1257",
+ 1257: "windows1257",
+
+ "iso885913": {
+ type: "singlebyte",
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u201d\u00a2\u00a3\u00a4\u201e\u00a6\u00a7\u00d8\u00a9\u0156\u00ab\u00ac\u00ad\u00ae\u00c6\u00b0\u00b1\u00b2\u00b3\u201c\u00b5\u00b6\u00b7\u00f8\u00b9\u0157\u00bb\u00bc\u00bd\u00be\u00e6\u0104\u012e\u0100\u0106\u00c4\u00c5\u0118\u0112\u010c\u00c9\u0179\u0116\u0122\u0136\u012a\u [...]
+ },
+ "baltic": "iso885913",
+ "cp28594": "iso885913",
+ 28594: "iso885913",
+
+};
diff --git a/encodings/cyrillic.js b/encodings/cyrillic.js
index 716b515..4a89f76 100644
--- a/encodings/cyrillic.js
+++ b/encodings/cyrillic.js
@@ -1,35 +1,26 @@
// Cyrillic encodings
-// Easy way to get chars for encoding, f.ex python: ''.join(map(chr, range(128, 256))).decode('windows-1251', 'replace')
-// TODO: bestfit (http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1251.txt)
module.exports = {
- // Win1251: http://msdn.microsoft.com/en-us/goglobal/cc305144
- // http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WindowsBestFit/bestfit1251.txt
"windows1251": {
type: "singlebyte",
- chars: "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬\xAD®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"
+ chars: "\u0402\u0403\u201a\u0453\u201e\u2026\u2020\u2021\u20ac\u2030\u0409\u2039\u040a\u040c\u040b\u040f\u0452\u2018\u2019\u201c\u201d\u2022\u2013\u2014\ufffd\u2122\u0459\u203a\u045a\u045c\u045b\u045f\u00a0\u040e\u045e\u0408\u00a4\u0490\u00a6\u00a7\u0401\u00a9\u0404\u00ab\u00ac\u00ad\u00ae\u0407\u00b0\u00b1\u0406\u0456\u0491\u00b5\u00b6\u00b7\u0451\u2116\u0454\u00bb\u0458\u0405\u0455\u0457\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u [...]
},
"win1251": "windows1251",
"cp1251": "windows1251",
- "1251": "windows1251",
1251: "windows1251",
- // KOI8-R: http://tools.ietf.org/html/rfc1489
- // http://unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
+ "iso88595": {
+ type: "singlebyte",
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040a\u040b\u040c\u00ad\u040e\u040f\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u [...]
+ },
+ "cp28595": "iso88595",
+ 28595: "iso88595",
+
"koi8r": {
- type: 'singlebyte',
- chars: '─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ'
+ type: "singlebyte",
+ chars: "\u2500\u2502\u250c\u2510\u2514\u2518\u251c\u2524\u252c\u2534\u253c\u2580\u2584\u2588\u258c\u2590\u2591\u2592\u2593\u2320\u25a0\u2219\u221a\u2248\u2264\u2265\u00a0\u2321\u00b0\u00b2\u00b7\u00f7\u2550\u2551\u2552\u0451\u2553\u2554\u2555\u2556\u2557\u2558\u2559\u255a\u255b\u255c\u255d\u255e\u255f\u2560\u2561\u0401\u2562\u2563\u2564\u2565\u2566\u2567\u2568\u2569\u256a\u256b\u256c\u00a9\u044e\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043a\u043b\u043c\u043d\u [...]
},
"cp20866": "koi8r",
20866: "koi8r",
-
- // ISO-8859-5:
- // http://unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT
- "iso88595": {
- type: 'singlebyte',
- chars: '
ЁЂЃЄЅІЇЈЉЊЋЌЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ'
- },
- "cp28595": "iso88595",
- 28595: "iso88595"
-};
+};
diff --git a/encodings/greek.js b/encodings/greek.js
index ff9fd51..bf26701 100644
--- a/encodings/greek.js
+++ b/encodings/greek.js
@@ -3,7 +3,7 @@
module.exports = {
"windows1253": {
type: "singlebyte",
- chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\ufffd\u2030\ufffd\u2039\ufffd\ufffd\ufffd\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\ufffd\u2122\ufffd\u203a\ufffd\ufffd\ufffd\ufffd\xa0\u0385\u0386\xa3\xa4\xa5\xa6\xa7\xa8\xa9\ufffd\xab\xac\xad\xae\u2015\xb0\xb1\xb2\xb3\u0384\xb5\xb6\xb7\u0388\u0389\u038a\xbb\u038c\xbd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\ufffd\u03a3\u03a4\u03a5\u [...]
+ chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\ufffd\u2030\ufffd\u2039\ufffd\ufffd\ufffd\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\ufffd\u2122\ufffd\u203a\ufffd\ufffd\ufffd\ufffd\u00a0\u0385\u0386\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\ufffd\u00ab\u00ac\u00ad\u00ae\u2015\u00b0\u00b1\u00b2\u00b3\u0384\u00b5\u00b6\u00b7\u0388\u0389\u038a\u00bb\u038c\u00bd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u [...]
},
"win1253": "windows1253",
"cp1253": "windows1253",
@@ -11,7 +11,7 @@ module.exports = {
"iso88597": {
type: "singlebyte",
- chars: "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\u2018\u2019\xa3\u20ac\u20af\xa6\xa7\xa8\xa9\u037a\xab\xac\xad\ufffd\u2015\xb0\xb1\xb2\xb3\u0384\u0385\u0386\xb7\u0388\u0389\u038a\xbb\u038c\xbd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\ufffd\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03aa\u03ab\u03ac\u03ad\u03ae\u [...]
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u2018\u2019\u00a3\u20ac\u20af\u00a6\u00a7\u00a8\u00a9\u037a\u00ab\u00ac\u00ad\ufffd\u2015\u00b0\u00b1\u00b2\u00b3\u0384\u0385\u0386\u00b7\u0388\u0389\u038a\u00bb\u038c\u00bd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u [...]
},
"greek": "iso88597",
"greek8": "iso88597",
@@ -20,7 +20,8 @@ module.exports = {
"cp737": {
type: "singlebyte",
- chars: "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c2\u03c4\u03c5\u03c6\u03c7\u03c8\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u [...]
+ chars: "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c2\u03c4\u03c5\u03c6\u03c7\u03c8\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u [...]
},
- 737: "cp737"
-}
+ 737: "cp737",
+
+};
diff --git a/encodings/hebrew.js b/encodings/hebrew.js
new file mode 100644
index 0000000..638ff2d
--- /dev/null
+++ b/encodings/hebrew.js
@@ -0,0 +1,21 @@
+// Hebrew encodings
+
+module.exports = {
+ "windows1255": {
+ type: "singlebyte",
+ chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\ufffd\u2039\ufffd\ufffd\ufffd\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\ufffd\u203a\ufffd\ufffd\ufffd\ufffd\u00a0\u00a1\u00a2\u00a3\u20aa\u00a5\u00a6\u00a7\u00a8\u00a9\u00d7\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00f7\u00bb\u00bc\u00bd\u00be\u00bf\u05b0\u05b1\u05b2\u05b3\u05b4\u05b5\u05b6\u05b7\u05b8\u05b9\ufffd\u05bb\u05bc\u05bd\u05be\u [...]
+ },
+ "win1255": "windows1255",
+ "cp1255": "windows1255",
+ 1255: "windows1255",
+
+ "iso88598": {
+ type: "singlebyte",
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\ufffd\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00d7\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00f7\u00bb\u00bc\u00bd\u00be\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u [...]
+ },
+ "hebrew": "iso88598",
+ "hebrew8": "iso88598",
+ "cp28598": "iso88598",
+ 28598: "iso88598",
+
+};
diff --git a/encodings/turkish.js b/encodings/turkish.js
index 6c8ca95..f29cbfc 100644
--- a/encodings/turkish.js
+++ b/encodings/turkish.js
@@ -3,14 +3,7 @@
module.exports = {
"windows1254": {
type: "singlebyte",
- chars: "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\uFFFD\uFFFD\uFFFD" +
- "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\uFFFD\uFFFD\u0178" +
- "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" +
- "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" +
- "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" +
- "\u011E\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u0130\u015E\u00DF" +
- "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" +
- "\u011F\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u0131\u015F\u00FF"
+ chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\ufffd\ufffd\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\ufffd\ufffd\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u [...]
},
"win1254": "windows1254",
"cp1254": "windows1254",
@@ -18,17 +11,11 @@ module.exports = {
"iso88599": {
type: "singlebyte",
- chars: "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" +
- "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" +
- "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" +
- "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" +
- "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" +
- "\u011E\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u0130\u015E\u00DF" +
- "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" +
- "\u011F\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u0131\u015F\u00FF"
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u [...]
},
"turkish": "iso88599",
"turkish8": "iso88599",
"cp28599": "iso88599",
- 28599: "iso88599"
-}
+ 28599: "iso88599",
+
+};
diff --git a/encodings/vietnamese.js b/encodings/vietnamese.js
new file mode 100644
index 0000000..5cafc37
--- /dev/null
+++ b/encodings/vietnamese.js
@@ -0,0 +1,12 @@
+// Vietnamese encodings
+
+module.exports = {
+ "windows1258": {
+ type: "singlebyte",
+ chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\ufffd\u2039\u0152\ufffd\ufffd\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\ufffd\u203a\u0153\ufffd\ufffd\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u0102\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u0300\u00cd\u00ce\u [...]
+ },
+ "win1258": "windows1258",
+ "cp1258": "windows1258",
+ 1258: "windows1258",
+
+};
diff --git a/encodings/western.js b/encodings/western.js
index 690a81f..e1d4649 100644
--- a/encodings/western.js
+++ b/encodings/western.js
@@ -1,9 +1,44 @@
+// Central and Eastern European encodings
+
module.exports = {
+ "windows1250": {
+ type: "singlebyte",
+ chars: "\u20ac\ufffd\u201a\ufffd\u201e\u2026\u2020\u2021\ufffd\u2030\u0160\u2039\u015a\u0164\u017d\u0179\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\ufffd\u2122\u0161\u203a\u015b\u0165\u017e\u017a\u00a0\u02c7\u02d8\u0141\u00a4\u0104\u00a6\u00a7\u00a8\u00a9\u015e\u00ab\u00ac\u00ad\u00ae\u017b\u00b0\u00b1\u02db\u0142\u00b4\u00b5\u00b6\u00b7\u00b8\u0105\u015f\u00bb\u013d\u02dd\u013e\u017c\u0154\u00c1\u00c2\u0102\u00c4\u0139\u0106\u00c7\u010c\u00c9\u0118\u00cb\u011a\u00cd\u00ce\u [...]
+ },
+ "win1250": "windows1250",
+ "cp1250": "windows1250",
+ 1250: "windows1250",
+
"windows1252": {
- type : "singlebyte",
- chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\ufffd\u017d\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\ufffd\u017e\u0178\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6 [...]
+ type: "singlebyte",
+ chars: "\u20ac\ufffd\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\ufffd\u017d\ufffd\ufffd\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\ufffd\u017e\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u [...]
+ },
+ "win1252": "windows1252",
+ "cp1252": "windows1252",
+ 1252: "windows1252",
+
+ "iso88591": {
+ type: "singlebyte",
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u [...]
+ },
+ "latin1": "iso88591",
+ "latin-1": "iso88591",
+ "cp28591": "iso88591",
+ 28591: "iso88591",
+
+ "iso88592": {
+ type: "singlebyte",
+ chars: "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f\u00a0\u0104\u02d8\u0141\u00a4\u013d\u015a\u00a7\u00a8\u0160\u015e\u0164\u0179\u00ad\u017d\u017b\u00b0\u0105\u02db\u0142\u00b4\u013e\u015b\u02c7\u00b8\u0161\u015f\u0165\u017a\u02dd\u017e\u017c\u0154\u00c1\u00c2\u0102\u00c4\u0139\u0106\u00c7\u010c\u00c9\u0118\u00cb\u011a\u00cd\u00ce\u [...]
+ },
+ "latin2": "iso88592",
+ "latin-2": "iso88592",
+ "cp28592": "iso88592",
+ 28592: "iso88592",
+
+ "cp850": {
+ type: "singlebyte",
+ chars: "\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u00c0\u00a9\u2563\u2551\u2557\u255d\u00a2\u00a5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u00e3\u00c3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u [...]
},
- "cp1252" : "windows1252",
- "1252" : "windows1252",
- 1252: "windows1252"
-};
\ No newline at end of file
+ 850: "cp850",
+
+};
diff --git a/generation/generate-encoding.js b/generation/generate-encoding.js
new file mode 100644
index 0000000..c7b5458
--- /dev/null
+++ b/generation/generate-encoding.js
@@ -0,0 +1,241 @@
+var fs = require("fs");
+var Iconv = require("iconv").Iconv;
+
+var files = [
+ {
+ name: "western",
+ description: "Central and Eastern European",
+ encodings: [
+ {
+ encoding: "WINDOWS-1250",
+ name: "windows1250",
+ aliases: ["win1250", "cp1250", 1250]
+ },
+ {
+ encoding: "WINDOWS-1252",
+ name: "windows1252",
+ aliases: ["win1252", "cp1252", 1252]
+ },
+ {
+ encoding: "ISO-8859-1",
+ name: "iso88591",
+ aliases: ["latin1", "latin-1", "cp28591", 28591]
+ },
+ {
+ encoding: "ISO-8859-2",
+ name: "iso88592",
+ aliases: ["latin2", "latin-2", "cp28592", 28592]
+ },
+ {
+ encoding: "CP850",
+ name: "cp850",
+ aliases: [850]
+ }
+ ]
+ },
+ {
+ name: "cyrillic",
+ description: "Cyrillic",
+ encodings: [
+ {
+ encoding: "WINDOWS-1251",
+ name: "windows1251",
+ aliases: ["win1251", "cp1251", 1251]
+ },
+ {
+ encoding: "ISO-8859-5",
+ name: "iso88595",
+ aliases: ["cp28595", 28595]
+ },
+ {
+ encoding: "KOI8-R",
+ name: "koi8r",
+ aliases: ["cp20866", 20866]
+ }
+ ]
+ },
+ {
+ name: "greek",
+ description: "Greek",
+ encodings: [
+ {
+ encoding: "WINDOWS-1253",
+ name: "windows1253",
+ aliases: ["win1253", "cp1253", 1253]
+ },
+ {
+ encoding: "ISO-8859-7",
+ name: "iso88597",
+ aliases: ["greek", "greek8", "cp28597", 28597]
+ },
+ {
+ encoding: "CP737",
+ name: "cp737",
+ aliases: [737]
+ }
+ ]
+ },
+ {
+ name: "turkish",
+ description: "Turkish",
+ encodings: [
+ {
+ encoding: "WINDOWS-1254",
+ name: "windows1254",
+ aliases: ["win1254", "cp1254", 1254]
+ },
+ {
+ encoding: "ISO-8859-9",
+ name: "iso88599",
+ aliases: ["turkish", "turkish8", "cp28599", 28599]
+ }
+ ]
+ },
+ {
+ name: "hebrew",
+ description: "Hebrew",
+ encodings: [
+ {
+ encoding: "WINDOWS-1255",
+ name: "windows1255",
+ aliases: ["win1255", "cp1255", 1255]
+ },
+ {
+ encoding: "ISO-8859-8",
+ name: "iso88598",
+ aliases: ["hebrew", "hebrew8", "cp28598", 28598]
+ }
+ ]
+ },
+ {
+ name: "arabic",
+ description: "Arabic",
+ encodings: [
+ {
+ encoding: "WINDOWS-1256",
+ name: "windows1256",
+ aliases: ["win1256", "cp1256", 1256]
+ },
+ {
+ encoding: "ISO-8859-6",
+ name: "iso88596",
+ aliases: ["arabic", "cp28596", 28596]
+ }
+ ]
+ },
+ {
+ name: "baltic",
+ description: "Estonian, Latvian and Lithuanian",
+ encodings: [
+ {
+ encoding: "WINDOWS-1257",
+ name: "windows1257",
+ aliases: ["win1257", "cp1257", 1257]
+ },
+ {
+ encoding: "ISO-8859-13",
+ name: "iso885913",
+ aliases: ["baltic", "cp28594", 28594]
+ }
+ ]
+ },
+ {
+ name: "vietnamese",
+ description: "Vietnamese",
+ encodings: [
+ {
+ encoding: "WINDOWS-1258",
+ name: "windows1258",
+ aliases: ["win1258", "cp1258", 1258]
+ }
+ ]
+ }
+];
+
+generateFiles();
+
+function generateFiles() {
+ files.forEach(function(file) {
+ generateFile(file);
+ });
+}
+
+function generateFile(file) {
+ var fileName = "encodings/" + file.name + ".js";
+ var fileContent = "";
+
+ fileContent += "// " + file.description + " encodings\n";
+ fileContent += "\n";
+ fileContent += "module.exports = {\n";
+
+ file.encodings.forEach(function(encoding) {
+ fileContent += generateEncoding(encoding);
+ });
+
+ fileContent += "};\n";
+
+ fs.writeFileSync(fileName, fileContent);
+}
+
+function generateEncoding(encoding) {
+ fileContent = "";
+
+ fileContent += ' "' + encoding.name + '": {\n';
+ fileContent += ' type: "singlebyte",\n';
+ fileContent += ' chars: "' + generateCharsString(encoding.encoding) + '",\n';
+ fileContent += ' },\n';
+
+ encoding.aliases.forEach(function(alias) {
+ if (typeof alias === "string") {
+ fileContent += ' "' + alias + '": "' + encoding.name + '",\n';
+ } else {
+ fileContent += ' ' + alias + ': "' + encoding.name + '",\n';
+ }
+ });
+
+ fileContent += '\n';
+
+ return fileContent;
+}
+
+function generateCharsString(encoding) {
+ console.log("Generate encoding for " + encoding);
+ var iconvToUtf8 = new Iconv(encoding, "utf8");
+ var chars = "";
+
+ for (var b = 0x80; b < 0x100; b++) {
+ chars += byteToUnicodeEscapedString(iconvToUtf8, b);
+ }
+
+ return chars;
+}
+
+function byteToUnicodeEscapedString(iconv, b) {
+ try {
+ var bufferSourceEnoding = new Buffer([b])
+ var bufferUtf8 = iconv.convert(bufferSourceEnoding);
+ var charCode = bufferUtf8.toString().charCodeAt(0);
+
+ return "\\u" + integerAsFourDigitHexString(charCode)
+ } catch (exception) {
+ if (exception.code === "EILSEQ") {
+ return "\\ufffd";
+ } else {
+ throw exception;
+ }
+ }
+}
+
+function integerAsFourDigitHexString(integer) {
+ var byte1 = byteToHexString(integer >> 8);
+ var byte2 = byteToHexString(integer & 0xff);
+
+ return byte1 + byte2;
+}
+
+function byteToHexString(byteValue) {
+ var highNibble = (byteValue >> 4).toString(16);
+ var lowNibble = (byteValue & 0x0f).toString(16);
+
+ return highNibble + lowNibble;
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-iconv-lite.git
More information about the Pkg-javascript-commits
mailing list