NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #42 most downloaded on npm
Convert character encodings in pure javascript.
Last release 3 months ago
03 Jul 2026
Ships unpredictably
gaps range from 9 days to 4.2 years
Rarely documented
notes for 4 of 52 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
57 releases · first in 2011
Remove support for Node <22 - by @bjohansebas in #396
Remove support for Node <22 - by @bjohansebas in #396
Node.js versions prior to 22 are no longer supported. This allows us to migrate to ESM and rely on require(esm), which does not work correctly on earlier versions.
Make the UTF-16 decoder WHATWG-conformant by @bjohansebas in #402
UTF-16LE/BE (and the ucs2/ucs-2 aliases) now decode through the standard TextDecoder, matching the Encoding Standard's shared UTF-16 decoder. As a result, unpaired/invalid surrogates and a trailing odd byte are replaced with U+FFFD instead of being passed through, and the Node and Web backends now behave identically. The decoder also no longer depends on the backend.
The utf-16 label still auto-detects endianness (UTF-16LE vs UTF-16BE) from the BOM and a space-based heuristic, defaulting to UTF-16LE. This is kept as an iconv-lite extension even though it is not spec-compliant — the Encoding Standard maps the utf-16 label directly to UTF-16LE.
Reject encoding labels with forbidden characters, per WHATWG - by @bjohansebas in #403
Following the Encoding Standard's label-trimming rules, only ASCII whitespace (tab, LF, FF, CR, space) may surround an encoding label. Labels wrapped in other control or separator characters — NUL, vertical tab, NBSP, or the line/paragraph separators — are now rejected instead of being silently stripped and accepted. Punctuation such as dashes and underscores within an otherwise-valid label is still normalized.
Make the UTF-7 and UTF-7-IMAP codecs RFC 2152 conformant - by @bjohansebas in #406
When decoding, ill-formed input — an incomplete code unit, non-zero Base64 padding bits, a shift-in ("+"/"&") not followed by Base64 or "-", or a non-ASCII byte outside a shifted run — is now replaced with U+FFFD instead of being passed through (lone surrogates still pass through as raw 16-bit code units). When encoding UTF-7, the optional "Set O" punctuation is now left as direct ASCII, so the output differs byte-for-byte for those characters, though it still decodes to the same text.
Make the UTF-32 codecs strict and browser-native - by @bjohansebas in #407
UTF-32LE/BE and the auto-detecting utf-32 codec now decode strictly per the Unicode Standard: a code unit that is a surrogate code point (U+D800–U+DFFF), is above U+10FFFF, or is a truncated trailing code unit is replaced with U+FFFD instead of being passed through. Encoding likewise replaces a lone (unpaired) surrogate with U+FFFD. The opt-in { fatal: true } decoding option makes ill-formed input throw instead. The codecs no longer use the Node Buffer internally, so they also work on the Web backend (browsers), like UTF-16. The internal _utf32 codec name (a private, undocumented implementation detail of the old codec-options indirection) was removed.
Speed up the UTF-32 codecs - by @bjohansebas in #407
UTF-32 decoding and encoding are noticeably faster, and encoding no longer allocates a Node Buffer.
Recognize more WHATWG encoding labels - by @bjohansebas in #403
Added the WHATWG label aliases for encodings iconv-lite already implements: unicode/csunicode/iso-10646-ucs-2/unicodefeff (UTF-16LE) and unicodefffe (UTF-16BE); x-cp1250–x-cp1258 (windows-1250–1258); dos-874; koi/koi8 (KOI8-R); x-mac-cyrillic/x-mac-ukrainian/x-mac-roman; x-euc-jp/cseucpkdfmtjapanese (EUC-JP); the iso-8859-6/iso-8859-8 -e/-i and visual/logical variants; csisolatin9; sun_eu_greek; unicode-2.0-utf-8; and more. (Labels whose encoding iconv-lite does not implement, such as iso-2022-jp and x-user-defined, remain unsupported.)
Add an opt-in fatal decoding option - by @bjohansebas in #402
Passing { fatal: true } to iconv.decode(...) makes the TextDecoder-backed encodings (UTF-8, UTF-16LE/BE) throw on invalid input, per the WHATWG Encoding Standard, instead of replacing it with U+FFFD. The default stays lenient (replacement).
Full Changelog: v1.0.0-alpha.1...v1.0.0-alpha.2
One column per quarter.
Remove support for Node <18 and safe-buffer dependency - by @bjohansebas @Phillip9587 and @TheThing in #265 and #349
Remove support for Node <18 and safe-buffer dependency - by @bjohansebas @Phillip9587 and @TheThing in #265 and #349
Node.js versions prior to 18 are no longer supported. This allows us to remove the safe-buffer dependency and use native Buffer methods available in Node 18 and later.
Use native TextDecoder for decoding - by @JohnGu9 and @bjohansebas in #316
While this improves compatibility with web standards, some edge cases may behave differently because the implementation of TextDecoder in Node.js or other JavaScript runtimes has issues with the specification.
Introduce backend abstraction layer to support to Uint8Array buffer implementation - by @ashtuchkin
This paves the way for supporting environments without Node.js Buffer, such as browsers using Uint8Array.
This is a work in progress, so many parts still rely on Buffer internally, but the goal is to eventually have full support for a Uint8Array based implementation.
Update of the GBK encoding table according to changes in the specification - by @bjohansebas in #371
The GBK encoding table was updated to reflect the latest changes in the Encoding Standard:
Full Changelog: v0.7.2...v1.0.0-alpha.1
Add iso-8859-8-i and iso-8859-8-e charset aliases - by @baptistejamin in #394
iso-8859-8-i and iso-8859-8-e charset aliases - by @baptistejamin in #394Fix UTF-32 streaming across chunk boundaries - by @spokodev and @bjohansebas in #393
When decoding a UTF-32 stream, a 4-byte code unit split across a chunk boundary was decoded incorrectly, and a truncated trailing unit is now replaced with U+FFFD instead of being dropped. When encoding, a surrogate held over between chunks no longer throws. Whole-buffer decode/encode were unaffected.
Full Changelog: v0.7.2...v0.7.3
Correction of CommonJS exports in TypeScript definitions - by @plbstl in #366
Correction of CommonJS exports in TypeScript definitions - by @plbstl in #366
Fixed the TypeScript definitions to correctly represent the CommonJS exports of the library.
This resolves issues where consumers using TypeScript would encounter errors due to incorrect
type definitions that did not align with the actual module exports.
Full Changelog: v0.7.1...v0.7.2
types: improve type definitions and add missing APIs - by @plbstl and @bjohansebas in #330
Full Changelog: v0.7.0...v0.7.1
Handle split surrogate pairs when encoding utf8 - by @yosion-p and @ashtuchkin in #282 :
Handle split surrogate pairs when encoding utf8 - by @yosion-p and @ashtuchkin in #282:
Handle a case where streaming utf8 encoder (converting js strings -> buffers) encounters
surrogate pairs split between chunks (last character of one chunk is high surrogate and first
character of the next chunk is a low surrogate).
Avoid false positives in encodingExists by using objects without a prototype - by @bjohansebas in #328
The encodingExists method could return incorrect results if the lookup matched properties inherited
from the prototype of the object that stores the encodings, such as constructor and others. This change
replaces that object with one that has no prototype, ensuring that only explicitly defined valid encodings
in the library are considered. In addition, the fix is applied to the internal cache system to avoid the same
kind of false positives
Full Changelog: v0.6.3...v0.7.0
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →