node.js - NodeJS https.get with unicode string results in Bad Request -
can me debug following code snippet? queries wikimedia api unicode characters, in case simplified chinese.
prooblem latest (0.12.6) node version (built source) options:
--with-intl=full-icu --download=all
results in empty body. check response find bad request.
however, same code snippet works fine node version 0.10.25 (i think got ubuntu package manager). apperently older version have internationalisation support default , newer ones not.
how can following code work latest nodejs version?
// generated coffeescript 1.9.3 (function() { var get, cmd, https, languagecode, options; https = require('https'); = function(options, callback) { return https.get(options, function(response) { var body; body = ''; response.on('data', function(data) { return body += data; }); return response.on('end', function() { return callback(body, response); }); }); }; languagecode = 'zh'; cmd = '笔记本电脑'; options = { host: languagecode + '.wikipedia.org', path: '/w/api.php?action=opensearch&search=' + cmd }; get(options, function(body, response) { return console.log(response); }); }).call(this);
turned out bug in node: https://github.com/joyent/node/issues/25634
Comments
Post a Comment