Can someone help me debug the following code snippet? It queries the WikiMedia API with unicode characters, in this case Simplified Chinese.
The prooblem is that with the latest (0.12.6) node version (built from source) with options:
--with-intl=full-icu --download=all
results in an empty body. Check the response to find Bad Request.
However, the same code snippet works fine with node version 0.10.25 (I think I got it from the Ubuntu package manager). Apperently older version have internationalisation support by default and newer ones do not.
How can I get the following code to work with the latest nodejs version?
// Generated by CoffeeScript 1.9.3
(function() {
var GET, cmd, https, languageCode, options;
https = require('https');
GET = 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 to be a bug in Node: https://github.com/joyent/node/issues/25634