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

Already on GitHub? Sign in to your account

Encoding defined in HTML meta tag... #183

Closed
williamvivier opened this Issue Feb 21, 2012 · 2 comments

Comments

Projects
None yet
3 participants

How to deal with encoding when is only defined in the HTML meta tag?

Thanks,

Owner

mikeal commented Feb 21, 2012

you can define the encoding we'll use as an option which will override anything we inspect from the headers.

@mikeal mikeal closed this Feb 21, 2012

Use the encoding: null option to get the body as a buffer and call .toString('ascii') to parse as ASCII with e.g. node-htmlparser to extract the meta tag.

Then you can decode the buffer again with the correct encoding, however... node only has built-in support for a handful of encodings, you'll have to roll your own or find a library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment