Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to get supported encodings #289

Open
eekboom opened this issue Jan 3, 2022 · 5 comments
Open

API to get supported encodings #289

eekboom opened this issue Jan 3, 2022 · 5 comments
Labels

Comments

@eekboom
Copy link

eekboom commented Jan 3, 2022

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.

@ashtuchkin
Copy link
Owner

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

@slugger941
Copy link

slugger941 commented Mar 16, 2022

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

@ashtuchkin
Copy link
Owner

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

@slugger941
Copy link

slugger941 commented Mar 16, 2022

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

@ashtuchkin
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants