ashtuchkin / iconv-lite

Convert character encodings in pure javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UCS-2BE, UCS-2LE not supported

eekboom opened this issue · comments

I can use UCS-2 for encoding, but does that give me UCS-2LE or UCS-2BE?
Please directly support both UCS-2LE and UCS2-BE!

Looking at https://en.wikipedia.org/wiki/Universal_Coded_Character_Set, I don't think these are standard (unlike e.g. UTF-16LE/BE). Given UCS-2 have been superseded by UTF-16 and we have both UTF-16LE and UTF-16BE available as a replacement, I think it would be better to use these latter ones.

If for some reason you need to specifically accept UCS-2BE or LE in your code, you can add an alias like this:

if (!iconv.encodingExists("ucs2be") {
    iconv.encodings["ucs2be"] = "utf16be":
    iconv.encodings["ucs2le"] = "utf16le":
}

Closing, let me know if you need anything else here.