{"id":22539465,"url":"https://github.com/kayahr/text-encoding","last_synced_at":"2025-07-21T09:05:32.098Z","repository":{"id":57124092,"uuid":"425078875","full_name":"kayahr/text-encoding","owner":"kayahr","description":"Text Encoder and Decoder","archived":false,"fork":false,"pushed_at":"2025-07-01T05:10:36.000Z","size":1572,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T06:24:04.425Z","etag":null,"topics":["decoder","decoding","encoder","encoding","encodings","text","text-decoder","text-encoder","text-encodings","typescript"],"latest_commit_sha":null,"homepage":"https://kayahr.github.io/text-encoding/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kayahr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"kayahr","custom":"https://paypal.me/kayaahr/"}},"created_at":"2021-11-05T20:40:27.000Z","updated_at":"2025-07-01T05:10:40.000Z","dependencies_parsed_at":"2024-06-21T07:26:19.736Z","dependency_job_id":"00b79f38-b15c-4598-85ed-13ecde8b5239","html_url":"https://github.com/kayahr/text-encoding","commit_stats":{"total_commits":32,"total_committers":1,"mean_commits":32.0,"dds":0.0,"last_synced_commit":"c68b4aeac090246615d8ffc739baf1bd4a46b685"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/kayahr/text-encoding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Ftext-encoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Ftext-encoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Ftext-encoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Ftext-encoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kayahr","download_url":"https://codeload.github.com/kayahr/text-encoding/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayahr%2Ftext-encoding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266270467,"owners_count":23902734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decoder","decoding","encoder","encoding","encodings","text","text-decoder","text-encoder","text-encodings","typescript"],"created_at":"2024-12-07T12:07:03.426Z","updated_at":"2025-07-21T09:05:32.075Z","avatar_url":"https://github.com/kayahr.png","language":"TypeScript","funding_links":["https://github.com/sponsors/kayahr","https://paypal.me/kayaahr/"],"categories":[],"sub_categories":[],"readme":"Text Encoding\n=============\n\n[GitHub] | [NPM] | [API Doc]\n\nThis project is a heavily refactored clone of an old abandoned [text-encoding](https://github.com/inexorabletash/text-encoding/) library with the following changes:\n\n* Refactored into a modern TypeScript project.\n* Separated the monolithic script into many logical modules.\n* Each encoding is a separate module and can be loaded individually if needed.\n* No longer a polyfill for the [Encoding API](https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API) but a API compatible replacement with advanced features like encoding support for not just UTF-8.\n\nUsage\n-----\n\nInstall the library as a dependency in your project:\n\n```\nnpm install @kayahr/text-encoding\n```\n\nAnd then use it like this:\n\n```typescript\nimport { TextEncoder, TextDecoder } from \"@kayahr/text-encoding\";\n\nconst encoder = new TextEncoder(\"big5\");\nconst encoded = encoder.encode(string);\n\nconst decoder = new TextDecoder(\"big5\");\nconst decoded = decoder.decode(encoded);\n```\n\nWhen importing the module from `@kayahr/text-encoding` then all provided encodings are loaded automatically. If you want to keep your application as small as possible then you can import the module like this instead:\n\n```typescript\nimport { TextEncoder } from \"@kayahr/text-encoding/no-encodings\";\n```\n\nWhen doing this then no encodings are loaded and only UTF-8 is supported. When you later need a specific encoding then use imports like this:\n\n```typescript\nimport \"@kayahr/text-encoding/encodings/shift_jis\";\n```\n\nOr import all encodings:\n\n```typescript\nimport \"@kayahr/text-encoding/encodings\";\n```\n\nThere is also a helper function for creating a text encoder which returns an implementation of the original TextEncoder (if present), when encoding is UTF-8 and an implementation of the custom TextEncoder from this library when encoding is not UTF-8:\n\n```typescript\nimport { createTextEncoder } from \"@kayahr/text-encoding\";\n\nconst encoder = createTextEncoder(encoding);\n```\n\nSupported encodings\n-------------------\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, utf8\n| utf-16le       | utf-16\n| utf-16be       |\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-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\n[API Doc]: 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayahr%2Ftext-encoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayahr%2Ftext-encoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayahr%2Ftext-encoding/lists"}