Juanjo Salvador Juanjo Salvador - 5 months ago 20
Node.js Question

Print japanese characters with node.js

I have a telegram bot that takes a string (japanese or spanish) and translate it using Google Translate's scrapper (this one https://github.com/statickidz/node-google-translate-free).

I tested it on Mac and works fine. But when I'm trying to deploy it on my VPS (Debian 8.3), it doesn't return japanese characters.

All I get, in Telegram and terminal, is this:


�����ɂ���'


Must be a charcode failure, but it seems UTF-8 in both sides...

UPDATE

My code for output is this:

sakura.onText(/\/esp (.+)/, function (msg, match) {
var fromId = msg.from.id;
var input = match[1];
translate({ text: input, source: 'es', target: 'ja' }, function(result) { sakura.sendMessage(fromId, "'" + input + "', traducido, significa '" + result + "'."); });
});


I've tested with japanese
locales
for Debian. Linux output are in japanese, but not my bot's output.

Answer

Solved using iconv for UTF-8 encode.