-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Unknown encoding #27
Comments
you probably just need to set the encoding paramater: https://github.com/mikeal/request/blob/master/README.md valid encoding options are defined in node.js, look at the docs for http.ClientResponse.setEncoding() |
Hi, Thanks. |
Hi! @Migrate: I'm confused about this issue. I tried to set encoding: 'iso-8859-15' in my get() call, but I'm getting an "Unknown encoding" exception. Did this work for you? @mikeal: I found this list of supported encodings: https://github.com/joyent/node/blob/master/lib/buffer.js#L63, and it doesn't include any ISO encodings, just Unicode. In my case, I was able to get what I need by requesting a binary response, then converting that using iconv-lite. But wouldn't it make sense to integrate this, as an option (and based on meta tag sniffing) into your request module itself? Thanks, Jean-Pierre |
Specific ISO encodings are useful when you're parsing the response but, most of the time, when the encoding matters this much what you actually want to do is pass the data over without parsing it at all, which is best accomplished with the default buffers. |
Thank you Mikael, that makes perfect sense to me. It's just that your module is being used in a "browser-like" fashion by some other modules - in my case, I'm using the spider module to extract information from a site and convert it to XML. Spider does not use your "encoding: null" feature, nor does it attempt to adapt to the encoding, so I guess that's where I should do my complaining. Still, as the request module is being used by many others, wouldn't it make sense to provide some sort of solution as part of this package, where it would be easy to find? Just my two cents. Thanks again, Jean-Pierre |
Hi,
I'm trying to fetch a web page that has latin characters and encoding set to iso-8859-15 but it doesn't work.
I always get the error: "throw new Error('Unknown encoding');"
Is this a bug or I'm I doing something wrong?
Can you tell me which encodings does it support?
Thanks.
Best regards,
Migrate
The text was updated successfully, but these errors were encountered: