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
Garbled content when accessing non-utf8 website (Shift_JIS) #1080
Comments
Here are the different encodings, |
This seems to work: var concat = require('concat-stream'),
Iconv = require('iconv').Iconv,
request = require('request');
var conv = new Iconv('Shift_JIS', 'utf8'),
req = request('http://www.alc.co.jp/');
req.pipe(conv);
req.on('error', function() {
console.log('an error occurred');
});
conv.pipe(concat(function(body) {
console.log(body.toString());
})); |
@nylen Thanks a lot for looking into this. Is there a way to detect mid stream that encoding is Shift_JIS and I should use Iconv ? Edit : Buffer.isEncoding can serve the purpose here. http://nodejs.org/api/buffer.html#buffer_class_method_buffer_isencoding_encoding |
I think that is pretty far outside the scope of the
|
I am trying to access a non utf-8 website using request module. Response is garbled for this request.
Even after setting the encoding option to Shift_JIS I am seeing garbled Japanese text.
The text was updated successfully, but these errors were encountered: