style-xlsx-m 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/CHANGELOG.md +264 -0
  2. package/LICENSE +201 -0
  3. package/README.md +145 -0
  4. package/bin/xlsx.njs +310 -0
  5. package/bower.json +22 -0
  6. package/dist/LICENSE +201 -0
  7. package/dist/cpexcel.full.mjs +1502 -0
  8. package/dist/cpexcel.js +1506 -0
  9. package/dist/shim.min.js +2 -0
  10. package/dist/xlsx.core.min.js +15 -0
  11. package/dist/xlsx.core.min.map +1 -0
  12. package/dist/xlsx.extendscript.js +24642 -0
  13. package/dist/xlsx.full.min.js +22 -0
  14. package/dist/xlsx.full.min.map +1 -0
  15. package/dist/xlsx.mini.min.js +9 -0
  16. package/dist/xlsx.mini.min.map +1 -0
  17. package/dist/xlsx.zahl.js +4 -0
  18. package/dist/xlsx.zahl.mjs +2 -0
  19. package/package.json +101 -0
  20. package/types/index.d.ts +900 -0
  21. package/types/tsconfig.json +15 -0
  22. package/xlsx-js-style/LICENSE +201 -0
  23. package/xlsx-js-style/bin/xlsx.njs +284 -0
  24. package/xlsx-js-style/dist/LICENSE +201 -0
  25. package/xlsx-js-style/dist/cpexcel.full.mjs +1502 -0
  26. package/xlsx-js-style/dist/cpexcel.js +1506 -0
  27. package/xlsx-js-style/dist/shim.min.js +2 -0
  28. package/xlsx-js-style/dist/xlsx.bundle.js +3 -0
  29. package/xlsx-js-style/dist/xlsx.bundle.js.map +1 -0
  30. package/xlsx-js-style/dist/xlsx.min.js +3 -0
  31. package/xlsx-js-style/dist/xlsx.min.js.map +1 -0
  32. package/xlsx-js-style/node_modules/.bin/adler32 +12 -0
  33. package/xlsx-js-style/node_modules/.bin/adler32.cmd +17 -0
  34. package/xlsx-js-style/node_modules/.bin/adler32.ps1 +28 -0
  35. package/xlsx-js-style/node_modules/.bin/codepage +12 -0
  36. package/xlsx-js-style/node_modules/.bin/codepage.cmd +17 -0
  37. package/xlsx-js-style/node_modules/.bin/codepage.ps1 +28 -0
  38. package/xlsx-js-style/node_modules/adler-32/LICENSE +14 -0
  39. package/xlsx-js-style/node_modules/adler-32/README.md +139 -0
  40. package/xlsx-js-style/node_modules/adler-32/adler32.js +92 -0
  41. package/xlsx-js-style/node_modules/adler-32/bin/adler32.njs +87 -0
  42. package/xlsx-js-style/node_modules/adler-32/package.json +42 -0
  43. package/xlsx-js-style/node_modules/adler-32/types/index.d.ts +14 -0
  44. package/xlsx-js-style/node_modules/adler-32/types/tsconfig.json +14 -0
  45. package/xlsx-js-style/node_modules/adler-32/types/tslint.json +11 -0
  46. package/xlsx-js-style/node_modules/codepage/LICENSE +14 -0
  47. package/xlsx-js-style/node_modules/codepage/README.md +347 -0
  48. package/xlsx-js-style/node_modules/codepage/bin/codepage.njs +98 -0
  49. package/xlsx-js-style/node_modules/codepage/bits/10000.js +2 -0
  50. package/xlsx-js-style/node_modules/codepage/bits/10001.js +115 -0
  51. package/xlsx-js-style/node_modules/codepage/bits/10002.js +253 -0
  52. package/xlsx-js-style/node_modules/codepage/bits/10003.js +183 -0
  53. package/xlsx-js-style/node_modules/codepage/bits/10004.js +2 -0
  54. package/xlsx-js-style/node_modules/codepage/bits/10005.js +2 -0
  55. package/xlsx-js-style/node_modules/codepage/bits/10006.js +2 -0
  56. package/xlsx-js-style/node_modules/codepage/bits/10007.js +2 -0
  57. package/xlsx-js-style/node_modules/codepage/bits/10008.js +167 -0
  58. package/xlsx-js-style/node_modules/codepage/bits/10010.js +2 -0
  59. package/xlsx-js-style/node_modules/codepage/bits/10017.js +2 -0
  60. package/xlsx-js-style/node_modules/codepage/bits/10021.js +2 -0
  61. package/xlsx-js-style/node_modules/codepage/bits/10029.js +2 -0
  62. package/xlsx-js-style/node_modules/codepage/bits/10079.js +2 -0
  63. package/xlsx-js-style/node_modules/codepage/bits/10081.js +2 -0
  64. package/xlsx-js-style/node_modules/codepage/bits/10082.js +2 -0
  65. package/xlsx-js-style/node_modules/codepage/bits/1010.js +2 -0
  66. package/xlsx-js-style/node_modules/codepage/bits/1026.js +2 -0
  67. package/xlsx-js-style/node_modules/codepage/bits/1047.js +2 -0
  68. package/xlsx-js-style/node_modules/codepage/bits/1132.js +2 -0
  69. package/xlsx-js-style/node_modules/codepage/bits/1140.js +2 -0
  70. package/xlsx-js-style/node_modules/codepage/bits/1141.js +2 -0
  71. package/xlsx-js-style/node_modules/codepage/bits/1142.js +2 -0
  72. package/xlsx-js-style/node_modules/codepage/bits/1143.js +2 -0
  73. package/xlsx-js-style/node_modules/codepage/bits/1144.js +2 -0
  74. package/xlsx-js-style/node_modules/codepage/bits/1145.js +2 -0
  75. package/xlsx-js-style/node_modules/codepage/bits/1146.js +2 -0
  76. package/xlsx-js-style/node_modules/codepage/bits/1147.js +2 -0
  77. package/xlsx-js-style/node_modules/codepage/bits/1148.js +2 -0
  78. package/xlsx-js-style/node_modules/codepage/bits/1149.js +2 -0
  79. package/xlsx-js-style/node_modules/codepage/bits/1250.js +2 -0
  80. package/xlsx-js-style/node_modules/codepage/bits/1251.js +2 -0
  81. package/xlsx-js-style/node_modules/codepage/bits/1252.js +2 -0
  82. package/xlsx-js-style/node_modules/codepage/bits/1253.js +2 -0
  83. package/xlsx-js-style/node_modules/codepage/bits/1254.js +2 -0
  84. package/xlsx-js-style/node_modules/codepage/bits/1255.js +2 -0
  85. package/xlsx-js-style/node_modules/codepage/bits/1256.js +2 -0
  86. package/xlsx-js-style/node_modules/codepage/bits/1257.js +2 -0
  87. package/xlsx-js-style/node_modules/codepage/bits/1258.js +2 -0
  88. package/xlsx-js-style/node_modules/codepage/bits/1361.js +231 -0
  89. package/xlsx-js-style/node_modules/codepage/bits/20000.js +193 -0
  90. package/xlsx-js-style/node_modules/codepage/bits/20001.js +217 -0
  91. package/xlsx-js-style/node_modules/codepage/bits/20002.js +167 -0
  92. package/xlsx-js-style/node_modules/codepage/bits/20003.js +213 -0
  93. package/xlsx-js-style/node_modules/codepage/bits/20004.js +193 -0
  94. package/xlsx-js-style/node_modules/codepage/bits/20005.js +223 -0
  95. package/xlsx-js-style/node_modules/codepage/bits/20105.js +2 -0
  96. package/xlsx-js-style/node_modules/codepage/bits/20106.js +2 -0
  97. package/xlsx-js-style/node_modules/codepage/bits/20107.js +2 -0
  98. package/xlsx-js-style/node_modules/codepage/bits/20108.js +2 -0
  99. package/xlsx-js-style/node_modules/codepage/bits/20261.js +31 -0
  100. package/xlsx-js-style/node_modules/codepage/bits/20269.js +2 -0
  101. package/xlsx-js-style/node_modules/codepage/bits/20273.js +2 -0
  102. package/xlsx-js-style/node_modules/codepage/bits/20277.js +2 -0
  103. package/xlsx-js-style/node_modules/codepage/bits/20278.js +2 -0
  104. package/xlsx-js-style/node_modules/codepage/bits/20280.js +2 -0
  105. package/xlsx-js-style/node_modules/codepage/bits/20284.js +2 -0
  106. package/xlsx-js-style/node_modules/codepage/bits/20285.js +2 -0
  107. package/xlsx-js-style/node_modules/codepage/bits/20290.js +2 -0
  108. package/xlsx-js-style/node_modules/codepage/bits/20297.js +2 -0
  109. package/xlsx-js-style/node_modules/codepage/bits/20420.js +2 -0
  110. package/xlsx-js-style/node_modules/codepage/bits/20423.js +2 -0
  111. package/xlsx-js-style/node_modules/codepage/bits/20424.js +2 -0
  112. package/xlsx-js-style/node_modules/codepage/bits/20833.js +2 -0
  113. package/xlsx-js-style/node_modules/codepage/bits/20838.js +2 -0
  114. package/xlsx-js-style/node_modules/codepage/bits/20866.js +2 -0
  115. package/xlsx-js-style/node_modules/codepage/bits/20871.js +2 -0
  116. package/xlsx-js-style/node_modules/codepage/bits/20880.js +2 -0
  117. package/xlsx-js-style/node_modules/codepage/bits/20905.js +2 -0
  118. package/xlsx-js-style/node_modules/codepage/bits/20924.js +2 -0
  119. package/xlsx-js-style/node_modules/codepage/bits/20932.js +189 -0
  120. package/xlsx-js-style/node_modules/codepage/bits/20936.js +167 -0
  121. package/xlsx-js-style/node_modules/codepage/bits/20949.js +183 -0
  122. package/xlsx-js-style/node_modules/codepage/bits/21025.js +2 -0
  123. package/xlsx-js-style/node_modules/codepage/bits/21027.js +2 -0
  124. package/xlsx-js-style/node_modules/codepage/bits/21866.js +2 -0
  125. package/xlsx-js-style/node_modules/codepage/bits/28591.js +2 -0
  126. package/xlsx-js-style/node_modules/codepage/bits/28592.js +2 -0
  127. package/xlsx-js-style/node_modules/codepage/bits/28593.js +2 -0
  128. package/xlsx-js-style/node_modules/codepage/bits/28594.js +2 -0
  129. package/xlsx-js-style/node_modules/codepage/bits/28595.js +2 -0
  130. package/xlsx-js-style/node_modules/codepage/bits/28596.js +2 -0
  131. package/xlsx-js-style/node_modules/codepage/bits/28597.js +2 -0
  132. package/xlsx-js-style/node_modules/codepage/bits/28598.js +2 -0
  133. package/xlsx-js-style/node_modules/codepage/bits/28599.js +2 -0
  134. package/xlsx-js-style/node_modules/codepage/bits/28600.js +2 -0
  135. package/xlsx-js-style/node_modules/codepage/bits/28601.js +2 -0
  136. package/xlsx-js-style/node_modules/codepage/bits/28603.js +2 -0
  137. package/xlsx-js-style/node_modules/codepage/bits/28604.js +2 -0
  138. package/xlsx-js-style/node_modules/codepage/bits/28605.js +2 -0
  139. package/xlsx-js-style/node_modules/codepage/bits/28606.js +2 -0
  140. package/xlsx-js-style/node_modules/codepage/bits/29001.js +2 -0
  141. package/xlsx-js-style/node_modules/codepage/bits/37.js +2 -0
  142. package/xlsx-js-style/node_modules/codepage/bits/38598.js +2 -0
  143. package/xlsx-js-style/node_modules/codepage/bits/437.js +2 -0
  144. package/xlsx-js-style/node_modules/codepage/bits/47451.js +2 -0
  145. package/xlsx-js-style/node_modules/codepage/bits/500.js +2 -0
  146. package/xlsx-js-style/node_modules/codepage/bits/50220.js +395 -0
  147. package/xlsx-js-style/node_modules/codepage/bits/50221.js +395 -0
  148. package/xlsx-js-style/node_modules/codepage/bits/50222.js +395 -0
  149. package/xlsx-js-style/node_modules/codepage/bits/50225.js +259 -0
  150. package/xlsx-js-style/node_modules/codepage/bits/50227.js +257 -0
  151. package/xlsx-js-style/node_modules/codepage/bits/51932.js +171 -0
  152. package/xlsx-js-style/node_modules/codepage/bits/51936.js +257 -0
  153. package/xlsx-js-style/node_modules/codepage/bits/51949.js +183 -0
  154. package/xlsx-js-style/node_modules/codepage/bits/52936.js +7 -0
  155. package/xlsx-js-style/node_modules/codepage/bits/54936.js +257 -0
  156. package/xlsx-js-style/node_modules/codepage/bits/57002.js +39 -0
  157. package/xlsx-js-style/node_modules/codepage/bits/57003.js +23 -0
  158. package/xlsx-js-style/node_modules/codepage/bits/57004.js +7 -0
  159. package/xlsx-js-style/node_modules/codepage/bits/57005.js +15 -0
  160. package/xlsx-js-style/node_modules/codepage/bits/57006.js +23 -0
  161. package/xlsx-js-style/node_modules/codepage/bits/57007.js +21 -0
  162. package/xlsx-js-style/node_modules/codepage/bits/57008.js +17 -0
  163. package/xlsx-js-style/node_modules/codepage/bits/57009.js +13 -0
  164. package/xlsx-js-style/node_modules/codepage/bits/57010.js +15 -0
  165. package/xlsx-js-style/node_modules/codepage/bits/57011.js +17 -0
  166. package/xlsx-js-style/node_modules/codepage/bits/620.js +2 -0
  167. package/xlsx-js-style/node_modules/codepage/bits/708.js +2 -0
  168. package/xlsx-js-style/node_modules/codepage/bits/720.js +2 -0
  169. package/xlsx-js-style/node_modules/codepage/bits/737.js +2 -0
  170. package/xlsx-js-style/node_modules/codepage/bits/775.js +2 -0
  171. package/xlsx-js-style/node_modules/codepage/bits/808.js +2 -0
  172. package/xlsx-js-style/node_modules/codepage/bits/850.js +2 -0
  173. package/xlsx-js-style/node_modules/codepage/bits/852.js +2 -0
  174. package/xlsx-js-style/node_modules/codepage/bits/855.js +2 -0
  175. package/xlsx-js-style/node_modules/codepage/bits/857.js +2 -0
  176. package/xlsx-js-style/node_modules/codepage/bits/858.js +2 -0
  177. package/xlsx-js-style/node_modules/codepage/bits/860.js +2 -0
  178. package/xlsx-js-style/node_modules/codepage/bits/861.js +2 -0
  179. package/xlsx-js-style/node_modules/codepage/bits/862.js +2 -0
  180. package/xlsx-js-style/node_modules/codepage/bits/863.js +2 -0
  181. package/xlsx-js-style/node_modules/codepage/bits/864.js +2 -0
  182. package/xlsx-js-style/node_modules/codepage/bits/865.js +2 -0
  183. package/xlsx-js-style/node_modules/codepage/bits/866.js +2 -0
  184. package/xlsx-js-style/node_modules/codepage/bits/869.js +2 -0
  185. package/xlsx-js-style/node_modules/codepage/bits/870.js +2 -0
  186. package/xlsx-js-style/node_modules/codepage/bits/872.js +2 -0
  187. package/xlsx-js-style/node_modules/codepage/bits/874.js +2 -0
  188. package/xlsx-js-style/node_modules/codepage/bits/875.js +2 -0
  189. package/xlsx-js-style/node_modules/codepage/bits/895.js +2 -0
  190. package/xlsx-js-style/node_modules/codepage/bits/932.js +95 -0
  191. package/xlsx-js-style/node_modules/codepage/bits/936.js +257 -0
  192. package/xlsx-js-style/node_modules/codepage/bits/949.js +253 -0
  193. package/xlsx-js-style/node_modules/codepage/bits/950.js +179 -0
  194. package/xlsx-js-style/node_modules/codepage/cptable.js +6347 -0
  195. package/xlsx-js-style/node_modules/codepage/cputils.js +528 -0
  196. package/xlsx-js-style/node_modules/codepage/dist/LICENSE +14 -0
  197. package/xlsx-js-style/node_modules/codepage/dist/cpexcel.full.js +1505 -0
  198. package/xlsx-js-style/node_modules/codepage/dist/cputils.js +528 -0
  199. package/xlsx-js-style/node_modules/codepage/dist/sbcs.full.js +639 -0
  200. package/xlsx-js-style/node_modules/codepage/node_modules/commander/CHANGELOG.md +350 -0
  201. package/xlsx-js-style/node_modules/codepage/node_modules/commander/LICENSE +22 -0
  202. package/xlsx-js-style/node_modules/codepage/node_modules/commander/Readme.md +408 -0
  203. package/xlsx-js-style/node_modules/codepage/node_modules/commander/index.js +1157 -0
  204. package/xlsx-js-style/node_modules/codepage/node_modules/commander/package.json +37 -0
  205. package/xlsx-js-style/node_modules/codepage/node_modules/commander/typings/index.d.ts +309 -0
  206. package/xlsx-js-style/node_modules/codepage/package.json +67 -0
  207. package/xlsx-js-style/node_modules/codepage/types/index.d.ts +39 -0
  208. package/xlsx-js-style/node_modules/codepage/types/tsconfig.json +14 -0
  209. package/xlsx-js-style/node_modules/codepage/types/tslint.json +11 -0
  210. package/xlsx-js-style/package.json +90 -0
  211. package/xlsx-js-style/types/index.d.ts +1065 -0
  212. package/xlsx-js-style/types/tsconfig.json +15 -0
  213. package/xlsx.js +24711 -0
  214. package/xlsx.mjs +24597 -0
  215. package/xlsxworker.js +14 -0
@@ -0,0 +1,347 @@
1
+ # js-codepage
2
+
3
+ [Codepages](https://en.wikipedia.org/wiki/Codepage) are character encodings. In
4
+ many contexts, single- or double-byte character sets are used in lieu of Unicode
5
+ encodings. The codepages map between characters and numbers.
6
+
7
+ ## Setup
8
+
9
+ In node:
10
+
11
+ ```js
12
+ var cptable = require('codepage');
13
+ ```
14
+
15
+ In the browser:
16
+
17
+ ```html
18
+ <script src="cptable.js"></script>
19
+ <script src="cputils.js"></script>
20
+ ```
21
+
22
+ Alternatively, use the full version in the dist folder:
23
+
24
+ ```html
25
+ <script src="cptable.full.js"></script>
26
+ ```
27
+
28
+ The complete set of codepages is large due to some Double Byte Character Set
29
+ encodings. A much smaller file that just includes SBCS codepages is provided in
30
+ this repo (`sbcs.js`), as well as a file for other projects (`cpexcel.js`)
31
+
32
+ If you know which codepages you need, you can include individual scripts for
33
+ each codepage. The individual files are provided in the `bits/` directory.
34
+ For example, to include only the Mac codepages:
35
+
36
+ ```html
37
+ <script src="bits/10000.js"></script>
38
+ <script src="bits/10006.js"></script>
39
+ <script src="bits/10007.js"></script>
40
+ <script src="bits/10029.js"></script>
41
+ <script src="bits/10079.js"></script>
42
+ <script src="bits/10081.js"></script>
43
+ ```
44
+
45
+ All of the browser scripts define and append to the `cptable` object. To rename
46
+ the object, edit the `JSVAR` shell variable in `make.sh` and run the script.
47
+
48
+ The utilities functions are contained in `cputils.js`, which assumes that the
49
+ appropriate codepage scripts were loaded.
50
+
51
+ The script will manipulate `module.exports` if available . This is not always
52
+ desirable. To prevent the behavior, define `DO_NOT_EXPORT_CODEPAGE`.
53
+
54
+ ## Usage
55
+
56
+ Most codepages are indexed by number. To get the Unicode character for a given
57
+ codepoint, use the `dec` property:
58
+
59
+ ```js
60
+ var unicode_cp10000_255 = cptable[10000].dec[255]; // ˇ
61
+ ```
62
+
63
+ To get the codepoint for a given character, use the `enc` property:
64
+
65
+ ```js
66
+ var cp10000_711 = cptable[10000].enc[String.fromCharCode(711)]; // 255
67
+ ```
68
+
69
+ There are a few utilities that deal with strings and buffers:
70
+
71
+ ```js
72
+ var 汇总 = cptable.utils.decode(936, [0xbb,0xe3,0xd7,0xdc]);
73
+ var buf = cptable.utils.encode(936, 汇总);
74
+ var sushi= cptable.utils.decode(65001, [0xf0,0x9f,0x8d,0xa3]); // 🍣
75
+ var sbuf = cptable.utils.encode(65001, sushi);
76
+ ```
77
+
78
+ `cptable.utils.encode(CP, data, ofmt)` accepts a String or Array of characters
79
+ and returns a representation controlled by `ofmt`:
80
+
81
+ - Default output is a Buffer (or Array) of bytes (integers between 0 and 255)
82
+ - If `ofmt == 'str'`, return a binary String (byte `i` is `o.charCodeAt(i)`)
83
+ - If `ofmt == 'arr'`, return an Array of bytes
84
+
85
+ `cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or
86
+ Buffer and returns a JS string.
87
+
88
+ ## Known Excel Codepages
89
+
90
+ A much smaller script, including only the codepages known to be used in Excel,
91
+ is available under the name `cpexcel`. It exposes the same variable `cptable`
92
+ and is suitable as a drop-in replacement when the full codepage tables are not
93
+ needed.
94
+
95
+ In node:
96
+
97
+ ```js
98
+ var cptable = require('codepage/dist/cpexcel.full');
99
+ ```
100
+
101
+ ## Rolling your own script
102
+
103
+ The `make.sh` script in the repo can take a manifest and generate JS source.
104
+
105
+ Usage:
106
+
107
+ ```bash
108
+ $ bash make.sh path_to_manifest output_file_name JSVAR
109
+ ```
110
+
111
+ where
112
+
113
+ - `JSVAR` is the name of the exported variable (generally `cptable`)
114
+ - `output_file_name` is the output file (`cpexcel.js`, `cptable.js`, ...)
115
+ - `path_to_manifest` is the path to the manifest file.
116
+
117
+ The manifest file is expected to be a CSV with 3 columns:
118
+
119
+ ```
120
+ <codepage number>,<source>,<size>
121
+ ```
122
+
123
+ If a source is specified, it will try to download the specified file and parse.
124
+ The file format is expected to follow the format from the unicode.org site.
125
+ The size should be `1` for a single-byte codepage and `2` for a double-byte
126
+ codepage. For mixed codepages (which use some single- and some double-byte
127
+ codes), the script assumes the mapping is a prefix code and generates efficient
128
+ JS code.
129
+
130
+ Generated scripts only include the mapping. `cat` a mapping with `cputils.js`
131
+ to produce a complete script like `cpexcel.full.js`.
132
+
133
+ ## Building the complete script
134
+
135
+ This script uses [voc](npm.im/voc). The script to build the codepage tables and
136
+ the JS source is `codepage.md`, so building is as simple as `voc codepage.md`.
137
+
138
+ ## Generated Codepages
139
+
140
+ The complete list of codepages can be found in the file `pages.csv`.
141
+
142
+ Some codepages are easier to implement algorithmically. Since those character
143
+ tables are not generated, there is no corresponding entry (they are "magic").
144
+
145
+ | CP# | Source | Description |
146
+ |--------:|:-----------:|:-----------------------------------------------------|
147
+ | ` 37` | unicode.org | IBM EBCDIC US-Canada |
148
+ | ` 437` | unicode.org | OEM United States |
149
+ | ` 500` | unicode.org | IBM EBCDIC International |
150
+ | ` 620` | NLS | Mazovia (Polish) MS-DOS |
151
+ | ` 708` | Windows 7 | Arabic (ASMO 708) |
152
+ | ` 720` | Windows 7 | Arabic (Transparent ASMO); Arabic (DOS) |
153
+ | ` 737` | unicode.org | OEM Greek (formerly 437G); Greek (DOS) |
154
+ | ` 775` | unicode.org | OEM Baltic; Baltic (DOS) |
155
+ | ` 808` | unicode.org | OEM Russian; Cyrillic + Euro symbol |
156
+ | ` 850` | unicode.org | OEM Multilingual Latin 1; Western European (DOS) |
157
+ | ` 852` | unicode.org | OEM Latin 2; Central European (DOS) |
158
+ | ` 855` | unicode.org | OEM Cyrillic (primarily Russian) |
159
+ | ` 857` | unicode.org | OEM Turkish; Turkish (DOS) |
160
+ | ` 858` | Windows 7 | OEM Multilingual Latin 1 + Euro symbol |
161
+ | ` 860` | unicode.org | OEM Portuguese; Portuguese (DOS) |
162
+ | ` 861` | unicode.org | OEM Icelandic; Icelandic (DOS) |
163
+ | ` 862` | unicode.org | OEM Hebrew; Hebrew (DOS) |
164
+ | ` 863` | unicode.org | OEM French Canadian; French Canadian (DOS) |
165
+ | ` 864` | unicode.org | OEM Arabic; Arabic (864) |
166
+ | ` 865` | unicode.org | OEM Nordic; Nordic (DOS) |
167
+ | ` 866` | unicode.org | OEM Russian; Cyrillic (DOS) |
168
+ | ` 869` | unicode.org | OEM Modern Greek; Greek, Modern (DOS) |
169
+ | ` 870` | Windows 7 | IBM EBCDIC Multilingual/ROECE (Latin 2) |
170
+ | ` 872` | unicode.org | OEM Cyrillic (primarily Russian) + Euro Symbol |
171
+ | ` 874` | unicode.org | Windows Thai |
172
+ | ` 875` | unicode.org | IBM EBCDIC Greek Modern |
173
+ | ` 895` | NLS | Kamenický (Czech) MS-DOS |
174
+ | ` 932` | unicode.org | Japanese Shift-JIS |
175
+ | ` 936` | unicode.org | Simplified Chinese GBK |
176
+ | ` 949` | unicode.org | Korean |
177
+ | ` 950` | unicode.org | Traditional Chinese Big5 |
178
+ | ` 1010` | IBM | IBM EBCDIC French |
179
+ | ` 1026` | unicode.org | IBM EBCDIC Turkish (Latin 5) |
180
+ | ` 1047` | Windows 7 | IBM EBCDIC Latin 1/Open System |
181
+ | ` 1132` | IBM | IBM EBCDIC Lao (1132 / 1133 / 1341) |
182
+ | ` 1140` | Windows 7 | IBM EBCDIC US-Canada (037 + Euro symbol) |
183
+ | ` 1141` | Windows 7 | IBM EBCDIC Germany (20273 + Euro symbol) |
184
+ | ` 1142` | Windows 7 | IBM EBCDIC Denmark-Norway (20277 + Euro symbol) |
185
+ | ` 1143` | Windows 7 | IBM EBCDIC Finland-Sweden (20278 + Euro symbol) |
186
+ | ` 1144` | Windows 7 | IBM EBCDIC Italy (20280 + Euro symbol) |
187
+ | ` 1145` | Windows 7 | IBM EBCDIC Latin America-Spain (20284 + Euro symbol) |
188
+ | ` 1146` | Windows 7 | IBM EBCDIC United Kingdom (20285 + Euro symbol) |
189
+ | ` 1147` | Windows 7 | IBM EBCDIC France (20297 + Euro symbol) |
190
+ | ` 1148` | Windows 7 | IBM EBCDIC International (500 + Euro symbol) |
191
+ | ` 1149` | Windows 7 | IBM EBCDIC Icelandic (20871 + Euro symbol) |
192
+ | ` 1200` | magic | Unicode UTF-16, little endian (BMP of ISO 10646) |
193
+ | ` 1201` | magic | Unicode UTF-16, big endian |
194
+ | ` 1250` | unicode.org | Windows Central Europe |
195
+ | ` 1251` | unicode.org | Windows Cyrillic |
196
+ | ` 1252` | unicode.org | Windows Latin I |
197
+ | ` 1253` | unicode.org | Windows Greek |
198
+ | ` 1254` | unicode.org | Windows Turkish |
199
+ | ` 1255` | unicode.org | Windows Hebrew |
200
+ | ` 1256` | unicode.org | Windows Arabic |
201
+ | ` 1257` | unicode.org | Windows Baltic |
202
+ | ` 1258` | unicode.org | Windows Vietnam |
203
+ | ` 1361` | Windows 7 | Korean (Johab) |
204
+ | `10000` | unicode.org | MAC Roman |
205
+ | `10001` | Windows 7 | Japanese (Mac) |
206
+ | `10002` | Windows 7 | MAC Traditional Chinese (Big5) |
207
+ | `10003` | Windows 7 | Korean (Mac) |
208
+ | `10004` | Windows 7 | Arabic (Mac) |
209
+ | `10005` | Windows 7 | Hebrew (Mac) |
210
+ | `10006` | unicode.org | Greek (Mac) |
211
+ | `10007` | unicode.org | Cyrillic (Mac) |
212
+ | `10008` | Windows 7 | MAC Simplified Chinese (GB 2312) |
213
+ | `10010` | Windows 7 | Romanian (Mac) |
214
+ | `10017` | Windows 7 | Ukrainian (Mac) |
215
+ | `10021` | Windows 7 | Thai (Mac) |
216
+ | `10029` | unicode.org | MAC Latin 2 (Central European) |
217
+ | `10079` | unicode.org | Icelandic (Mac) |
218
+ | `10081` | unicode.org | Turkish (Mac) |
219
+ | `10082` | Windows 7 | Croatian (Mac) |
220
+ | `12000` | magic | Unicode UTF-32, little endian byte order |
221
+ | `12001` | magic | Unicode UTF-32, big endian byte order |
222
+ | `20000` | Windows 7 | CNS Taiwan (Chinese Traditional) |
223
+ | `20001` | Windows 7 | TCA Taiwan |
224
+ | `20002` | Windows 7 | ETEN Taiwan (Chinese Traditional) |
225
+ | `20003` | Windows 7 | IBM5550 Taiwan |
226
+ | `20004` | Windows 7 | TeleText Taiwan |
227
+ | `20005` | Windows 7 | Wang Taiwan |
228
+ | `20105` | Windows 7 | Western European IA5 (IRV International Alphabet 5) |
229
+ | `20106` | Windows 7 | IA5 German (7-bit) |
230
+ | `20107` | Windows 7 | IA5 Swedish (7-bit) |
231
+ | `20108` | Windows 7 | IA5 Norwegian (7-bit) |
232
+ | `20127` | magic | US-ASCII (7-bit) |
233
+ | `20261` | Windows 7 | T.61 |
234
+ | `20269` | Windows 7 | ISO 6937 Non-Spacing Accent |
235
+ | `20273` | Windows 7 | IBM EBCDIC Germany |
236
+ | `20277` | Windows 7 | IBM EBCDIC Denmark-Norway |
237
+ | `20278` | Windows 7 | IBM EBCDIC Finland-Sweden |
238
+ | `20280` | Windows 7 | IBM EBCDIC Italy |
239
+ | `20284` | Windows 7 | IBM EBCDIC Latin America-Spain |
240
+ | `20285` | Windows 7 | IBM EBCDIC United Kingdom |
241
+ | `20290` | Windows 7 | IBM EBCDIC Japanese Katakana Extended |
242
+ | `20297` | Windows 7 | IBM EBCDIC France |
243
+ | `20420` | Windows 7 | IBM EBCDIC Arabic |
244
+ | `20423` | Windows 7 | IBM EBCDIC Greek |
245
+ | `20424` | Windows 7 | IBM EBCDIC Hebrew |
246
+ | `20833` | Windows 7 | IBM EBCDIC Korean Extended |
247
+ | `20838` | Windows 7 | IBM EBCDIC Thai |
248
+ | `20866` | Windows 7 | Russian Cyrillic (KOI8-R) |
249
+ | `20871` | Windows 7 | IBM EBCDIC Icelandic |
250
+ | `20880` | Windows 7 | IBM EBCDIC Cyrillic Russian |
251
+ | `20905` | Windows 7 | IBM EBCDIC Turkish |
252
+ | `20924` | Windows 7 | IBM EBCDIC Latin 1/Open System (1047 + Euro symbol) |
253
+ | `20932` | Windows 7 | Japanese (JIS 0208-1990 and 0212-1990) |
254
+ | `20936` | Windows 7 | Simplified Chinese (GB2312-80) |
255
+ | `20949` | Windows 7 | Korean Wansung |
256
+ | `21025` | Windows 7 | IBM EBCDIC Cyrillic Serbian-Bulgarian |
257
+ | `21027` | NLS | Extended/Ext Alpha Lowercase |
258
+ | `21866` | Windows 7 | Ukrainian Cyrillic (KOI8-U) |
259
+ | `28591` | unicode.org | ISO 8859-1 Latin 1 (Western European) |
260
+ | `28592` | unicode.org | ISO 8859-2 Latin 2 (Central European) |
261
+ | `28593` | unicode.org | ISO 8859-3 Latin 3 |
262
+ | `28594` | unicode.org | ISO 8859-4 Baltic |
263
+ | `28595` | unicode.org | ISO 8859-5 Cyrillic |
264
+ | `28596` | unicode.org | ISO 8859-6 Arabic |
265
+ | `28597` | unicode.org | ISO 8859-7 Greek |
266
+ | `28598` | unicode.org | ISO 8859-8 Hebrew (ISO-Visual) |
267
+ | `28599` | unicode.org | ISO 8859-9 Turkish |
268
+ | `28600` | unicode.org | ISO 8859-10 Latin 6 |
269
+ | `28601` | unicode.org | ISO 8859-11 Latin (Thai) |
270
+ | `28603` | unicode.org | ISO 8859-13 Latin 7 (Estonian) |
271
+ | `28604` | unicode.org | ISO 8859-14 Latin 8 (Celtic) |
272
+ | `28605` | unicode.org | ISO 8859-15 Latin 9 |
273
+ | `28606` | unicode.org | ISO 8859-15 Latin 10 |
274
+ | `29001` | Windows 7 | Europa 3 |
275
+ | `38598` | Windows 7 | ISO 8859-8 Hebrew (ISO-Logical) |
276
+ | `47451` | unicode.org | Atari ST/TT |
277
+ | `50220` | Windows 7 | ISO 2022 JIS Japanese with no halfwidth Katakana |
278
+ | `50221` | Windows 7 | ISO 2022 JIS Japanese with halfwidth Katakana |
279
+ | `50222` | Windows 7 | ISO 2022 Japanese JIS X 0201-1989 (1 byte Kana-SO/SI)|
280
+ | `50225` | Windows 7 | ISO 2022 Korean |
281
+ | `50227` | Windows 7 | ISO 2022 Simplified Chinese |
282
+ | `51932` | Windows 7 | EUC Japanese |
283
+ | `51936` | Windows 7 | EUC Simplified Chinese |
284
+ | `51949` | Windows 7 | EUC Korean |
285
+ | `52936` | Windows 7 | HZ-GB2312 Simplified Chinese |
286
+ | `54936` | Windows 7 | GB18030 Simplified Chinese (4 byte) |
287
+ | `57002` | Windows 7 | ISCII Devanagari |
288
+ | `57003` | Windows 7 | ISCII Bengali |
289
+ | `57004` | Windows 7 | ISCII Tamil |
290
+ | `57005` | Windows 7 | ISCII Telugu |
291
+ | `57006` | Windows 7 | ISCII Assamese |
292
+ | `57007` | Windows 7 | ISCII Oriya |
293
+ | `57008` | Windows 7 | ISCII Kannada |
294
+ | `57009` | Windows 7 | ISCII Malayalam |
295
+ | `57010` | Windows 7 | ISCII Gujarati |
296
+ | `57011` | Windows 7 | ISCII Punjabi |
297
+ | `65000` | magic | Unicode (UTF-7) |
298
+ | `65001` | magic | Unicode (UTF-8) |
299
+
300
+ `unicode.org` refers to the Unicode Consortium Public Mappings, a database of
301
+ various mappings between Unicode characters and respective character sets. The
302
+ tables are processed by a few scripts in the build process.
303
+
304
+ `IBM` refers to the IBM coded character set database. Even though IBM uses a
305
+ different numbering scheme from Windows, the IBM numbers are used when there is
306
+ no conflict. The tables are manually generated from the symbol manifests.
307
+
308
+ `Windows 7` refers to direct inspection of Windows 7 machines using .NET class
309
+ `System.Text.Encoding`. The enclosed `MakeEncoding.cs` C# program brute-forces
310
+ code pages. `MakeEncoding.cs` deviates from unicode.org in some cases. When they
311
+ map a given code to different characters, unicode.org value is used. When
312
+ unicode.org does not prescribe a value, `MakeEncoding.cs` value is used.
313
+
314
+ `NLS` refers to the National Language Support files supplied in various versions
315
+ of Windows. In older versions of Windows (like Windows 98) these files followed
316
+ the name pattern `CP_#.NLS`, but newer versions use the name pattern `C_#.NLS`.
317
+
318
+ ## Testing
319
+
320
+ `make test` will run the nodejs-based test.
321
+
322
+ To run the in-browser tests, run a local server and go to the `ctest` directory.
323
+ `make ctestserv` will start a python `SimpleHTTPServer` server on port 8000.
324
+
325
+ To update the browser artifacts, run `make ctest`.
326
+
327
+ ## Sources
328
+
329
+ - [Unicode Consortium Public Mappings](http://www.unicode.org/Public/MAPPINGS/)
330
+ - [Windows Code Page Enumeration](http://msdn.microsoft.com/en-us/library/cc195051.aspx)
331
+ - [Windows Code Page Identifiers](http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756.aspx)
332
+ - [IBM Coded Character Sets](https://www-01.ibm.com/software/globalization/ccsid/ccsid_registered.html)
333
+
334
+ ## License
335
+
336
+ Please consult the attached LICENSE file for details. All rights not explicitly
337
+ granted by the Apache 2.0 license are reserved by the Original Author.
338
+
339
+ ## Badges
340
+
341
+ [![Sauce Test Status](https://saucelabs.com/browser-matrix/codepage.svg)](https://saucelabs.com/u/codepage)
342
+
343
+ [![Build Status](https://travis-ci.org/SheetJS/js-codepage.svg?branch=master)](https://travis-ci.org/SheetJS/js-codepage)
344
+
345
+ [![Coverage Status](http://img.shields.io/coveralls/SheetJS/js-codepage/master.svg)](https://coveralls.io/r/SheetJS/js-codepage?branch=master)
346
+
347
+ [![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/js-codepage?pixel)](https://github.com/SheetJS/js-codepage)
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ /* js-codepage (C) 2014-present SheetJS -- http://sheetjs.com */
3
+ /* vim: set ts=2 ft=javascript: */
4
+ /* eslint-env node */
5
+ var codepage = require('../');
6
+ require('exit-on-epipe');
7
+ var fs = require('fs'), program/*:any*/ = (require('commander')/*:any*/);
8
+ program
9
+ .version(codepage.version)
10
+ .usage('[options] <file>')
11
+ .option('-f, --from-code <code>', 'codepage of input (default 65001 utf8)')
12
+ .option('-t, --to-code <code>', 'codepage of output (default 65001 utf8)')
13
+ .option('-o, --output <file>', 'output file (<file>.<to> if specified)')
14
+ .option('-B, --bom', 'write BOM (for unicode codepages)')
15
+ .option('-F, --force', 'force writing to stdout for non-utf8 codepages')
16
+ .option('-l, --list', 'List supported codepages');
17
+
18
+ program.on('--help', function() {
19
+ console.log(' Codepage descriptions can be found in the README');
20
+ console.log(' http://oss.sheetjs.com/js-codepage/README.md');
21
+ console.log(' Support email: dev.codepage@sheetjs.com');
22
+ });
23
+
24
+ program.parse(process.argv);
25
+
26
+ if(program.list) {
27
+ var l/*:Array<number>*/ = [];
28
+ Object.keys(codepage).forEach(function(x) { if(parseInt(x, 10) == +x) l.push(+x); });
29
+ Object.keys(codepage.utils.magic).forEach(function(x) { if(parseInt(x, 10) == +x && +x != 16969) l.push(+x); });
30
+ l.sort(function(a,b) { return a-b; }).forEach(function(x) { console.log(x); });
31
+ process.exit();
32
+ }
33
+
34
+ var fr = +program.fromCode || 65001;
35
+ var to = +program.toCode || 65001;
36
+ var f = program.args[0];
37
+ var o = program.output;
38
+
39
+ if(!process.stdin.isTTY) f = f || "-";
40
+
41
+ if(f !== "-" && !fs.existsSync(f)) {
42
+ console.error('codepage: must specify a filename');
43
+ process.exit(13);
44
+ }
45
+
46
+ function concat(func) {
47
+ // $FlowIgnore
48
+ var writable = require('stream').Writable();
49
+ var buf = [];
50
+ writable._write = function(chunk, e, cb) { buf.push(chunk); cb(); };
51
+ writable._writev = function(chunks, cb) { chunks.forEach(function(c) { buf.push(c.chunk); cb(); }); };
52
+ writable.on('finish', function() { func(Buffer.concat(buf)); });
53
+ return writable;
54
+ }
55
+
56
+ if(f === "-") process.stdin.pipe(concat(process_text));
57
+ else process_text(fs.readFileSync(f));
58
+
59
+ function process_text(text/*:Buffer*/) {
60
+ var dec/*:Buffer*/ = (codepage.utils.decode(fr, text)/*:any*/);
61
+
62
+ var bom/*:Array<Buffer>*/ = [];
63
+ bom[1200] = new Buffer([0xFF, 0xFE]);
64
+ bom[1201] = new Buffer([0xFE, 0xFF]);
65
+ bom[12000] = new Buffer([0xFF, 0xFE, 0x00, 0x00]);
66
+ bom[12001] = new Buffer([0x00, 0x00, 0xFE, 0xFF]);
67
+ bom[16969] = new Buffer([0x69, 0x69]);
68
+ bom[65000] = new Buffer([0x2B, 0x2F, 0x76, 0x2B]);
69
+ bom[65001] = new Buffer([0xEF, 0xBB, 0xBF]);
70
+
71
+ var mybom = (program.bom && bom[to] ? bom[to] : "");
72
+ var out/*:any*/ = to === 65001 ? dec.toString('utf8') : codepage.utils.encode(to, dec);
73
+
74
+ /* if output file is specified */
75
+ if(o) writefile(o, out, mybom);
76
+ /* utf8 -> print to stdout */
77
+ else if(to === 65001) logit(out, mybom);
78
+ /* stdout piped to process -> print */
79
+ else if(!process.stdout.isTTY) logit(out, mybom);
80
+ /* forced */
81
+ else if(program.force) logit(out, mybom);
82
+ /* input file specified -> write to file */
83
+ else if(f !== "-") writefile(f + "." + to, out, mybom);
84
+ else {
85
+ console.error('codepage: use force (-F, --force) to print ' + to + ' codes');
86
+ process.exit(14);
87
+ }
88
+ }
89
+
90
+ function logit(out/*:Buffer*/, bom) {
91
+ process.stdout.write(bom);
92
+ process.stdout.write(out);
93
+ }
94
+
95
+ function writefile(o, out/*:Buffer*/, bom) {
96
+ fs.writeFileSync(o, bom);
97
+ fs.appendFileSync(o, out);
98
+ }
@@ -0,0 +1,2 @@
1
+ if(typeof cptable === 'undefined') cptable = {};
2
+ cptable[10000] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();