{"$schema":"https://json.schemastore.org/package","name":"@kayahr/text-encoding","version":"2.2.0","type":"module","description":"Text encoder and decoder","keywords":["typescript","text","text-encoder","text-decoder","encodings","text-encodings","encoding","encode","decoding","decode"],"license":"MIT","author":{"name":"Klaus Reimer","email":"k@ailis.de"},"repository":{"type":"git","url":"git+https://github.com/kayahr/text-encoding.git"},"homepage":"https://github.com/kayahr/text-encoding","bugs":{"url":"https://github.com/kayahr/text-encoding/issues"},"funding":"https://github.com/kayahr/text-encoding?sponsor=1","publishConfig":{"access":"public"},"exports":{".":"./lib/main/index.js","./no-encodings":"./lib/main/index-no-encodings.js","./encodings/*.js":"./lib/main/encodings/*.js","./encodings/*":"./lib/main/encodings/*.js","./encodings":"./lib/main/encodings.js"},"scripts":{"clean":"rm -rf lib","build":"run build:*","build:compile":"tsc","test":"run test:*","test:unit":"ntest","test:lint":"oxlint --type-aware --deny-warnings","test:apidoc":"typedoc --emit none","test:spell":"cspell --no-progress --no-summary","apidoc":"typedoc","prepare":"run clean build"},"devDependencies":{"@kayahr/assert":"1.5.0","@kayahr/cspell":"10.0.1-bundle.2","@kayahr/npm-utils":"1.1.2","@kayahr/ntest":"1.3.0","@kayahr/oxlint-config":"1.41.0","@kayahr/typedoc":"0.28.20-bundle.1","@types/node":"26.4.0","typescript":"7.0.2"},"gitHead":"254423e0d2dbbda0551f9c149d202d19f481b360","_id":"@kayahr/text-encoding@2.2.0","_nodeVersion":"24.20.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-9jjWumQ9+fI1SfiRo1oSqMm4Wz95A/XtRDXB1C4pyNLo8HhtiyZMAzVPGplhMreymaroGyPqRyOy3h+3khPJVg==","shasum":"29ef055e5df2a6865fae50426a29869eb13aa5f5","tarball":"http://registry-npm.ywwl.com/@kayahr/text-encoding/download/@kayahr/text-encoding-2.2.0.tgz","fileCount":337,"unpackedSize":777466,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCVuKDXh47jZLpQel1yxnKyWWKRBk+YTcvofYM0SpcMqwIhAOK/MSUeWLHnaG4xdVbmfd+VmM4eP+vWG8RYBWDr+3Qa"}],"size":245998,"noattachment":false,"key":"/@kayahr/text-encoding/-/@kayahr/text-encoding-2.2.0.tgz"},"_npmUser":{"name":"kayahr","email":"k@ailis.de"},"directories":{},"maintainers":[{"name":"kayahr","email":"k@ailis.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/text-encoding_2.2.0_1787921679668_0.9619268807500578"},"_hasShrinkwrap":false,"readme":"Text Encoding\n=============\n\n[GitHub] | [npm] | [API documentation]\n\nThis project is a heavily refactored fork of the archived [text-encoding](https://github.com/inexorabletash/text-encoding/) library with the following changes:\n\n* Refactored into a modern, modular TypeScript project with separately loadable encodings.\n* Corrected mapping tables and malformed-input recovery across multi-byte encodings.\n* Fixed reusable encoder and decoder state after errors.\n* Added support for modern `BufferSource` inputs, including `SharedArrayBuffer`.\n* Improved lookup and large-input performance.\n* Expanded exhaustive regression and conformance testing.\n\nThe library provides importable `TextEncoder` and `TextDecoder` implementations without modifying the corresponding global objects. Unlike the native `TextEncoder`, it can encode all supported encodings, not only UTF-8.\n\nUsage\n-----\n\nInstall the library as a dependency in your project:\n\n```\nnpm install @kayahr/text-encoding\n```\n\nThen use it as follows:\n\n```typescript\nimport { TextEncoder, TextDecoder } from \"@kayahr/text-encoding\";\n\nconst input = \"中文\";\nconst encoder = new TextEncoder(\"big5\");\nconst encoded = encoder.encode(input);\n\nconst decoder = new TextDecoder(\"big5\");\nconst decoded = decoder.decode(encoded);\n```\n\nImporting `@kayahr/text-encoding` automatically registers all supported encodings. To keep your application as small as possible, use the UTF-8-only entry point instead:\n\n```typescript\nimport { TextEncoder } from \"@kayahr/text-encoding/no-encodings\";\n```\n\nThis entry point registers only UTF-8. To add a specific encoding, import its module:\n\n```typescript\nimport { TextEncoder } from \"@kayahr/text-encoding/no-encodings\";\nimport \"@kayahr/text-encoding/encodings/shift_jis\";\n\nconst encoder = new TextEncoder(\"shift_jis\");\n```\n\nTo register all encodings instead:\n\n```typescript\nimport \"@kayahr/text-encoding/encodings\";\n```\n\nThe `createTextEncoder` helper uses the native `TextEncoder` for UTF-8 when available and this library's implementation for all other encodings:\n\n```typescript\nimport { createTextEncoder } from \"@kayahr/text-encoding\";\n\nconst encoder = createTextEncoder(\"big5\");\n```\n\nSupported encodings\n-------------------\n\nAll listed encodings are supported for both encoding and decoding. Encoding labels are matched case-insensitively and surrounding whitespace is ignored.\n\n| Encoding       | Aliases\n|----------------|-----------------------------------------------------------------------------------------------------\n| big5           | big5-hkscs, cn-big5, csbig5, x-x-big5\n| euc-jp         | cseucpkdfmtjapanese, x-euc-jp\n| euc-kr         | cseuckr, csksc56011987, iso-ir-149, korean, ks_c_5601-1987, ks_c_5601-1989, ksc5601, ksc_5601, windows-949\n| gb18030        |\n| gbk            | chinese, csgb2312, csiso58gb231280, gb2312, gb_2312, gb_2312-80, iso-ir-58, x-gbk\n| ibm866         | 866, cp866, csibm866\n| iso-2022-jp    | csiso2022jp\n| shift_jis      | csshiftjis, ms932, ms_kanji, shift-jis, sjis, windows-31j, x-sjis\n| utf-8          | unicode-1-1-utf-8, unicode11utf8, unicode20utf8, utf8, x-unicode20utf8\n| utf-16le       | csunicode, iso-10646-ucs-2, ucs-2, unicode, unicodefeff, utf-16\n| utf-16be       | unicodefffe\n| iso-8859-2     | csisolatin2, iso-ir-101, iso8859-2, iso88592, iso_8859-2, iso_8859-2:1987, l2, latin2\n| iso-8859-3     | csisolatin3, iso-ir-109, iso8859-3, iso88593, iso_8859-3, iso_8859-3:1988, l3, latin3\n| iso-8859-4     | csisolatin4, iso-ir-110, iso8859-4, iso88594, iso_8859-4, iso_8859-4:1988, l4, latin4\n| iso-8859-5     | csisolatincyrillic, cyrillic, iso-ir-144, iso8859-5, iso88595, iso_8859-5, iso_8859-5:1988\n| iso-8859-6     | arabic, asmo-708, csiso88596e, csiso88596i, csisolatinarabic, ecma-114, iso-8859-6-e, iso-8859-6-i, iso-ir-127, iso8859-6, iso88596, iso_8859-6, iso_8859-6:1987\n| iso-8859-7     | csisolatingreek, ecma-118, elot_928, greek, greek8, iso-ir-126, iso8859-7, iso88597, iso_8859-7, iso_8859-7:1987, sun_eu_greek\n| iso-8859-8     | csiso88598e, csisolatinhebrew, hebrew, iso-8859-8-e, iso-ir-138, iso8859-8, iso88598, iso_8859-8, iso_8859-8:1988, visual\n| iso-8859-8-i   | csiso88598i, logical\n| iso-8859-10    | csisolatin6, iso-ir-157, iso8859-10, iso885910, l6, latin6\n| iso-8859-13    | iso8859-13, iso885913\n| iso-8859-14    | iso8859-14, iso885914\n| iso-8859-15    | csisolatin9, iso8859-15, iso885915, iso_8859-15, l9\n| iso-8859-16    |\n| koi8-r         | cskoi8r, koi, koi8, koi8_r\n| koi8-u         | koi8-ru\n| macintosh      | csmacintosh, mac, x-mac-roman\n| windows-874    | dos-874, iso-8859-11, iso8859-11, iso885911, tis-620\n| windows-1250   | cp1250, x-cp1250\n| windows-1251   | cp1251, x-cp1251\n| windows-1252   | 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, x-cp1252\n| windows-1253   | cp1253, x-cp1253\n| windows-1254   | cp1254, csisolatin5, iso-8859-9, iso-ir-148, iso8859-9, iso88599, iso_8859-9, iso_8859-9:1989, l5, latin5, x-cp1254\n| windows-1255   | cp1255, x-cp1255\n| windows-1256   | cp1256, x-cp1256\n| windows-1257   | cp1257, x-cp1257\n| windows-1258   | cp1258, x-cp1258\n| x-mac-cyrillic | x-mac-ukrainian\n| x-user-defined |\n\n[API documentation]: https://kayahr.github.io/text-encoding/\n[GitHub]: https://github.com/kayahr/text-encoding\n[npm]: https://www.npmjs.com/package/@kayahr/text-encoding\n","publish_time":1787921679813,"_cnpm_publish_time":1787921679813,"dist-tags":{"latest":"2.2.0"}}