iconv-lite icon indicating copy to clipboard operation
iconv-lite copied to clipboard

API to get supported encodings

Open eekboom opened this issue 4 years ago • 5 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.

eekboom avatar Jan 03 '22 11:01 eekboom

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).

ashtuchkin avatar Jan 03 '22 15:01 ashtuchkin

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??

slugger941 avatar Mar 16 '22 01:03 slugger941

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

ashtuchkin avatar Mar 16 '22 04:03 ashtuchkin

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

slugger941 avatar Mar 16 '22 05:03 slugger941

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.

ashtuchkin avatar Mar 16 '22 05:03 ashtuchkin