@dpuse/dpuse-shared 1.0.106 → 1.0.110

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.
package/README.md CHANGED
@@ -83,65 +83,101 @@ Character encoding types with detection and decodability flags, a catalogue of e
83
83
 
84
84
  <!-- ENCODINGS_START -->
85
85
 
86
- The table below lists every supported encoding.
87
-
88
- - **Detectable** — [chardet](https://github.com/runk/node-chardet) can identify the encoding from a file's contents. A test checks this column against chardet's detectors, so it fails if a chardet upgrade adds, drops or renames one.
89
- - **Decodable** — the browser's built-in `TextDecoder` can decode it. The four that cannot are refused by all the major browsers: `iso-2022-cn` and `iso-2022-kr` are blocked by the WHATWG Encoding Standard for security reasons, and UTF-32 is not part of the standard.
90
- - **Decoded As** — the encoding browsers actually use, where it differs from the name. The Encoding Standard treats some names as aliases, so for example `latin1` and `ascii` are decoded as `windows-1252`. The practical effects: bytes 0x80–0x9F decode as Windows-1252 characters (such as `€` and curly quotes) rather than control codes, `ascii` never rejects bytes above 0x7F, and a big-endian UTF-16 file read as `utf-16` decodes as little-endian and comes out garbled.
91
-
92
- The major browsers all follow the Encoding Standard, so the Decodable and Decoded As columns hold for each of them. A test checks both columns against Node's `TextDecoder`, which follows the same standard. They were also confirmed in Chrome 154, Edge 154, Firefox 156 and Safari 26.6 (October 2026), and all four gave identical results. To re-check them on a Mac, run `npm run check:browsers` after a build.
93
-
94
- | Group | Encoding | Detectable | Decodable | Decoded As |
95
- | :------------------ | :------------- | :--------: | :-------: | :----------- |
96
- | — | ascii | ✅ | ✅ | windows-1252 |
97
- | — | utf-8 | ✅ | ✅ | — |
98
- | Arabic | iso-8859-6 | ✅ | ✅ | — |
99
- | Arabic | windows-1256 | ✅ | ✅ | — |
100
- | Baltic | iso-8859-13 | ❌ | ✅ | — |
101
- | Baltic | iso-8859-4 | ❌ | ✅ | — |
102
- | Baltic | windows-1257 | ✅ | ✅ | — |
103
- | Celtic | iso-8859-14 | ❌ | ✅ | — |
104
- | Central European | iso-8859-2 | ✅ | ✅ | — |
105
- | Central European | windows-1250 | ✅ | ✅ | — |
106
- | Chinese Simplified | gb18030 | ✅ | ✅ | — |
107
- | Chinese Simplified | gbk | ❌ | ✅ | — |
108
- | Chinese Simplified | iso-2022-cn | ✅ | ❌ | — |
109
- | Chinese Traditional | big5 | ✅ | ✅ | — |
110
- | Cyrillic | ibm866 | ❌ | ✅ | — |
111
- | Cyrillic | iso-8859-5 | ✅ | ✅ | — |
112
- | Cyrillic | koi8-r | ✅ | ✅ | — |
113
- | Cyrillic | koi8-u | ❌ | ✅ | — |
114
- | Cyrillic | windows-1251 | ✅ | ✅ | — |
115
- | Cyrillic | x-mac-cyrillic | ❌ | ✅ | — |
116
- | Greek | iso-8859-7 | ✅ | ✅ | — |
117
- | Greek | windows-1253 | ✅ | ✅ | — |
118
- | Hebrew | iso-8859-8 | ✅ | ✅ | — |
119
- | Hebrew | windows-1255 | ✅ | ✅ | — |
120
- | Japanese | euc-jp | ✅ | ✅ | — |
121
- | Japanese | iso-2022-jp | ✅ | ✅ | — |
122
- | Japanese | shift_jis | ✅ | ✅ | — |
123
- | Korean | euc-kr | ✅ | ✅ | — |
124
- | Korean | iso-2022-kr | ✅ | ❌ | — |
125
- | Nordic | iso-8859-10 | ❌ | ✅ | — |
126
- | Other | x-user-defined | ❌ | ✅ | — |
127
- | Romanian | iso-8859-16 | ❌ | ✅ | — |
128
- | Southern European | iso-8859-3 | ❌ | ✅ | — |
129
- | Thai | iso-8859-11 | ❌ | ✅ | windows-874 |
130
- | Thai | tis-620 | ❌ | ✅ | windows-874 |
131
- | Thai | windows-874 | ✅ | ✅ | — |
132
- | Turkish | iso-8859-9 | ✅ | ✅ | windows-1254 |
133
- | Turkish | windows-1254 | ✅ | ✅ | — |
134
- | Unicode 16 | utf-16 | ❌ | ✅ | utf-16le |
135
- | Unicode 16 | utf-16be | ✅ | ✅ | — |
136
- | Unicode 16 | utf-16le | ✅ | ✅ | — |
137
- | Unicode 32 | utf-32be | ✅ | ❌ | — |
138
- | Unicode 32 | utf-32le | ✅ | ❌ | — |
139
- | Vietnamese | windows-1258 | ✅ | ✅ | — |
140
- | Western | iso-8859-1 | ✅ | ✅ | windows-1252 |
141
- | Western | iso-8859-15 | ❌ | ✅ | — |
142
- | Western | latin1 | ❌ | ✅ | windows-1252 |
143
- | Western | macintosh | ❌ | ✅ | — |
144
- | Western | windows-1252 | ✅ | ✅ | — |
86
+ The table below lists every encoding [jschardet](https://github.com/aadsm/jschardet) can identify from a file's contents, under the name it reports. A test checks the table against jschardet's own list of encodings, so it fails if a jschardet upgrade adds, drops, renames or remaps one.
87
+
88
+ - **Decodable** — the browser's built-in `TextDecoder` can decode it. Those that cannot are refused by all the major browsers: `HZ-GB-2312` and `ISO-2022-KR` are blocked by the WHATWG Encoding Standard for security reasons, and the rest, such as UTF-32, UTF-7 and the DOS, Mac and mainframe code pages, are not part of the standard. A file in one can still be named, even though it cannot be read. `UTF-16` is marked not decodable because its byte-order mark decides which way round it is read, so it has no single browser name.
89
+ - **Decoded As** — the name browsers decode it with, taken from jschardet's own map. Browsers treat some names as aliases, so for example `ascii` and `ISO-8859-1` are decoded as `windows-1252`. The practical effects: bytes 0x80–0x9F decode as Windows-1252 characters (such as `€` and curly quotes) rather than control codes, and `ascii` never rejects bytes above 0x7F.
90
+
91
+ The major browsers all follow the Encoding Standard, so these columns hold for each of them. A test checks that Node's `TextDecoder`, which follows the same standard, accepts every Decoded As name as its own. They were also confirmed in Chrome 154, Edge 154, Firefox 156 and Safari 26.6 (October 2026), and all four gave identical results. To re-check them on a Mac, run `npm run check:browsers` after a build.
92
+
93
+ | Group | Encoding | Decodable | Decoded As |
94
+ | :------------------ | :-------------- | :-------: | :------------- |
95
+ | — | ascii | ✅ | windows-1252 |
96
+ | — | utf-8 | ✅ | utf-8 |
97
+ | — | UTF-8-SIG | ✅ | utf-8 |
98
+ | Arabic | cp1006 | ❌ | — |
99
+ | Arabic | cp720 | ❌ | — |
100
+ | Arabic | cp864 | ❌ | — |
101
+ | Arabic | ISO-8859-6 | ✅ | iso-8859-6 |
102
+ | Arabic | Windows-1256 | ✅ | windows-1256 |
103
+ | Baltic | cp775 | ❌ | — |
104
+ | Baltic | ISO-8859-13 | ✅ | iso-8859-13 |
105
+ | Baltic | iso8859-4 | ✅ | iso-8859-4 |
106
+ | Baltic | Windows-1257 | ✅ | windows-1257 |
107
+ | Celtic | iso8859-14 | ✅ | iso-8859-14 |
108
+ | Central European | cp852 | ❌ | — |
109
+ | Central European | ISO-8859-2 | ✅ | iso-8859-2 |
110
+ | Central European | MacLatin2 | ❌ | — |
111
+ | Central European | Windows-1250 | ✅ | windows-1250 |
112
+ | Chinese Simplified | GB18030 | ✅ | gb18030 |
113
+ | Chinese Simplified | HZ-GB-2312 | ❌ | — |
114
+ | Chinese Traditional | Big5 | ✅ | big5 |
115
+ | Cyrillic | cp1125 | ❌ | — |
116
+ | Cyrillic | IBM855 | ❌ | — |
117
+ | Cyrillic | IBM866 | ✅ | ibm866 |
118
+ | Cyrillic | ISO-8859-5 | ✅ | iso-8859-5 |
119
+ | Cyrillic | KOI8-R | ✅ | koi8-r |
120
+ | Cyrillic | koi8-t | ❌ | — |
121
+ | Cyrillic | koi8-u | ✅ | koi8-u |
122
+ | Cyrillic | KZ1048 | ❌ | — |
123
+ | Cyrillic | MacCyrillic | ✅ | x-mac-cyrillic |
124
+ | Cyrillic | ptcp154 | ❌ | — |
125
+ | Cyrillic | Windows-1251 | ✅ | windows-1251 |
126
+ | Greek | cp737 | ❌ | — |
127
+ | Greek | cp869 | ❌ | — |
128
+ | Greek | cp875 | ❌ | — |
129
+ | Greek | ISO-8859-7 | ✅ | iso-8859-7 |
130
+ | Greek | MacGreek | ❌ | — |
131
+ | Greek | Windows-1253 | ✅ | windows-1253 |
132
+ | Hebrew | cp424 | ❌ | — |
133
+ | Hebrew | cp856 | ❌ | — |
134
+ | Hebrew | cp862 | ❌ | — |
135
+ | Hebrew | ISO-8859-8 | ✅ | iso-8859-8-i |
136
+ | Hebrew | Windows-1255 | ✅ | windows-1255 |
137
+ | Japanese | CP932 | ✅ | shift_jis |
138
+ | Japanese | EUC-JP | ✅ | euc-jp |
139
+ | Japanese | ISO-2022-JP | ✅ | iso-2022-jp |
140
+ | Japanese | iso2022_jp_2004 | ❌ | — |
141
+ | Japanese | iso2022_jp_ext | ❌ | — |
142
+ | Japanese | SHIFT_JIS | ✅ | shift_jis |
143
+ | Korean | CP949 | ✅ | euc-kr |
144
+ | Korean | EUC-KR | ✅ | euc-kr |
145
+ | Korean | ISO-2022-KR | ❌ | — |
146
+ | Korean | Johab | ❌ | — |
147
+ | Nordic | cp861 | ❌ | — |
148
+ | Nordic | cp865 | ❌ | — |
149
+ | Nordic | iso8859-10 | ✅ | iso-8859-10 |
150
+ | Nordic | MacIceland | ❌ | — |
151
+ | Other | utf-7 | ❌ | — |
152
+ | Romanian | iso8859-16 | ✅ | iso-8859-16 |
153
+ | Southern European | iso8859-3 | ✅ | iso-8859-3 |
154
+ | Thai | CP874 | ✅ | windows-874 |
155
+ | Thai | TIS-620 | ✅ | windows-874 |
156
+ | Turkish | cp1026 | ❌ | — |
157
+ | Turkish | cp857 | ❌ | — |
158
+ | Turkish | ISO-8859-9 | ✅ | windows-1254 |
159
+ | Turkish | MacTurkish | ❌ | — |
160
+ | Turkish | Windows-1254 | ✅ | windows-1254 |
161
+ | Unicode 16 | utf-16-be | ✅ | utf-16be |
162
+ | Unicode 16 | utf-16-le | ✅ | utf-16le |
163
+ | Unicode 16 | UTF-16 | ❌ | — |
164
+ | Unicode 32 | utf-32-be | ❌ | — |
165
+ | Unicode 32 | utf-32-le | ❌ | — |
166
+ | Unicode 32 | UTF-32 | ❌ | — |
167
+ | Vietnamese | cp1258 | ✅ | windows-1258 |
168
+ | Western | cp1140 | ❌ | — |
169
+ | Western | cp273 | ❌ | — |
170
+ | Western | cp437 | ❌ | — |
171
+ | Western | cp500 | ❌ | — |
172
+ | Western | cp850 | ❌ | — |
173
+ | Western | cp858 | ❌ | — |
174
+ | Western | cp860 | ❌ | — |
175
+ | Western | cp863 | ❌ | — |
176
+ | Western | hp-roman8 | ❌ | — |
177
+ | Western | ISO-8859-1 | ✅ | windows-1252 |
178
+ | Western | iso8859-15 | ✅ | iso-8859-15 |
179
+ | Western | MacRoman | ✅ | macintosh |
180
+ | Western | Windows-1252 | ✅ | windows-1252 |
145
181
 
146
182
  <!-- ENCODINGS_END -->
147
183
 
@@ -161,6 +197,22 @@ OData-to-internal type conversion, file path name and extension extraction, numb
161
197
 
162
198
  See [API_REFERENCE.md](./API_REFERENCE.md) for the complete API reference, including all exported schemas, types, classes, constants, and actions, grouped by topic.
163
199
 
200
+ ## Test Data
201
+
202
+ The encoding tests use sample files in [`tests/fixtures/encodings`](./tests/fixtures/encodings). They're used only to test and evaluate character encoding detection and decoding.
203
+
204
+ - **Universal Declaration of Human Rights:** from NLTK's "Universal Declaration of Human Rights Corpus (Unicode Version)" ([udhr2.zip](https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/udhr2.zip)), which holds the declaration in 388 languages as UTF-8 text files named by language code, such as `rus.txt`.
205
+ - It's in the public domain, as recorded in [NLTK's data index](https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml) (the `udhr2` entry).
206
+ - NLTK's copy comes from the [Unicode UDHR project](https://unicode.org/udhr/). We use NLTK's copy because the Unicode project's own file links no longer work.
207
+ - We use excerpts of about 1,000 characters in 29 languages, re-encoded into each of the 86 encodings.
208
+ - Characters an encoding can't hold were removed.
209
+ - Arabic letters in `cp864` and `cp1006` are stored as presentation forms, as those encodings require.
210
+ - **Written for these tests:** the seven CSV files, and two Welsh sentences added to `iso8859-14.txt`. They're under this project's licence.
211
+
212
+ A second set of tests uses chardet's own test files, in [`tests/fixtures/encodings/chardet`](./tests/fixtures/encodings/chardet): its [unit-test files](https://github.com/runk/node-chardet/tree/master/src/test/data/encodings) and [corpus](https://github.com/runk/node-chardet/tree/master/corpus), copyright 2024 Dmitry Shirokov, under the MIT licence in that folder's `LICENSE` file.
213
+
214
+ The October 2026 comparison of chardet and jschardet also used [chardet/test-data](https://github.com/chardet/test-data), which isn't included here, because each of its files is copyright its publisher.
215
+
164
216
  <!-- DEPENDENCY_LICENSES_START -->
165
217
 
166
218
  ## Dependency Licenses
@@ -189,14 +241,14 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
189
241
 
190
242
  | Chunk/Module/File | Composition |
191
243
  | :-------------------------------------------------------------------------- | :------------------------------------------ |
192
- | **dist/dpuse-shared.es.js** | 34.1 kB · gzip 8.7 kB · 100.0% of the build |
193
- | &nbsp;&nbsp;&nbsp;&nbsp;src | `█████████████░░░░░░░` 65.0% · 22.2 kB |
194
- | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ index.ts | `▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░` 54.8% · 18.7 kB |
195
- | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ connectorConfig.schema.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.5% · 1.2 kB |
196
- | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ componentConfig.schema.ts | `▒░░░░░░░░░░░░░░░░░░░` 2.7% · 936 B |
197
- | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ 7 smaller files | `▒░░░░░░░░░░░░░░░░░░░` 4.1% · 1.4 kB |
198
- | &nbsp;&nbsp;&nbsp;&nbsp;valibot → dist/index.mjs | `████░░░░░░░░░░░░░░░░` 20.6% · 7.0 kB |
199
- | &nbsp;&nbsp;&nbsp;&nbsp;(bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 14.4% · 4.9 kB |
244
+ | **dist/dpuse-shared.es.js** | 35.1 kB · gzip 9.2 kB · 100.0% of the build |
245
+ | &nbsp;&nbsp;&nbsp;&nbsp;src | `█████████████░░░░░░░` 65.6% · 23.0 kB |
246
+ | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ index.ts | `▒▒▒▒▒▒▒▒▒▒▒░░░░░░░░░` 55.7% · 19.5 kB |
247
+ | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ connectorConfig.schema.ts | `▒░░░░░░░░░░░░░░░░░░░` 3.4% · 1.2 kB |
248
+ | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ componentConfig.schema.ts | `▒░░░░░░░░░░░░░░░░░░░` 2.6% · 936 B |
249
+ | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;↳ 7 smaller files | `▒░░░░░░░░░░░░░░░░░░░` 4.0% · 1.4 kB |
250
+ | &nbsp;&nbsp;&nbsp;&nbsp;valibot → dist/index.mjs | `████░░░░░░░░░░░░░░░░` 20.0% · 7.0 kB |
251
+ | &nbsp;&nbsp;&nbsp;&nbsp;(bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 14.3% · 5.0 kB |
200
252
 
201
253
  Bars show each row's share of its output file. ↳ rows are part of the row above.
202
254