ashtuchkin / iconv-lite

Convert character encodings in pure javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API to get supported encodings

eekboom opened this issue · comments

If you want to offer the user a list of encodings, it would be nice to get that list out of icon-lite rather than hardcoding it.

We currently have iconv.encodingExists which can help in some cases, but I can see the value in having an official way to list encodings, yes. I'll try to add it before 1.0 release.

If you need it now, you can probably refer to keys of iconv.encodings after they are lazy-loaded by calling any other method. The keys are normalized (lowercased, stripped of spaces and dashes).

Hello I also have same requirement. I hope API to get encoding type by user locale.
If user's locale is 'kr'(korea), the API return supported encoding type like KS_C_5601 or Windows949, EUC-KR.
Can you support this API??

That's a different API. iconv-lite doesn't even have this information at this point.

Ok.
Do you have any idea to support that API??or know any way to get encoding type by user locale(ISO 3166)??

Well, an obvious idea would be to create such a mapping yourself and potentially publish a npm module.
At this point, I don't think it's a great fit for iconv-lite.