Comments (2)
Hi!
I haven't checked it manually, but I think most names that are used in the real world will be interpreted correctly. First, names are not case sensitive in iconv-lite and all non-alphanumeric characters are stripped, as well as what seems like a year suffix (i.e. ISO_8859-1:1987
= ISO8859-1
= iso88591
). Then, there are lots of aliases, for example win1251
= windows1251
= 1251
= Windows-1251
.
If you have a limited set of encodings that you support, you can check them all with iconv.encodingExists(name)
function. Then, you can either tell me to add an alias, or do it in your project with the following code:
var iconv = require('iconv-lite');
iconv.encode('utf8', ''); // load encoding definitions
iconv.encodings['<new alias name>'] = '<alias to what>'; // both lowercase, alphanumeric.
If, on the other hand, you want to support all IANA names and aliases, then, probably, iconv-lite is not an option because it doesn't support all the older encodings (neither do node-iconv AFAIK).
from iconv-lite.
Thanks, for response. My purpose is getting some possibly text content via http requests, and from headers get charset and decode them to utf-8 (i.e. that is what browsers do =), as header Content-Type: mime; charset=IANA_charset name or alias, thus i was need to know that question.
I do not want to support all encodings, it is enough most common one byte encoding and utf-8, utf-16*.
Thanks that point to . encodingExists
it should be enough to see if will be any errors, just because it is missing, but i think with main encoding names, should no be problems (i have another module that resolve aliases).
from iconv-lite.
Related Issues (20)
- UCS-2BE, UCS-2LE not supported HOT 1
- Give users the option to load a subset of encodings to minimize js bundle size HOT 1
- Version w/Uint8Array option? HOT 2
- Problem with the type declaration of the first parameter of the decode method in index.d.ts? HOT 5
- Unable to resolve module string_decoder could not be found HOT 3
- Help bundling for vanilla web HOT 1
- Wrong maccyrillic decoding HOT 11
- can not work in cocos creator
- it affects page performance.
- setHighWaterMark
- Cant build project with iconv-lite HOT 1
- "Encoding not recognized: 'UNICODE UTF-8'" HOT 1
- Provide performant iconv.encodeInto API (previously iconv.byteLength) HOT 5
- UTF-16BE not exported correctly HOT 1
- when to update the version?
- Is the project still under maintenance? HOT 5
- How to stop iconv-lite from automatically console.log the entire document HOT 2
- CP737 encoding for Greek HOT 2
- Convert wrong character when utf8 to sjis
- to support in browser it's better modify the type declaration Buffer to Buffer | Uint8Array in index.d.ts HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iconv-lite.