charset
charset copied to clipboard
Get the content charset from header and html content-type.
If the charset is "utf-8" "utf8" is returned. If the charset is anything else (eg: "utf-16") it is returned with a dash. Having inconsistent formatting of results is not helpful...
``` var charset = require('charset'); charset({}, '\n\n\n\n ') ``` Running this code returns `'iso-8859'` instead of `'iso-8859-1'`
Hello I just encountered a website that has ``. The current regexp detects the charset as `text` instead of iso-8859-1. html5 seems to accept the `charset` attribute (https://developer.mozilla.org/fr/docs/Web/HTML/Element/meta#attr-charset) ; I...