Z
Z
zhencowalencko2018-02-07 23:52:37
Node.js
zhencowalencko, 2018-02-07 23:52:37

How to send cyrillic in request.js request?

Hello!
Node.js question + request module.
Why, when sending the Cyrillic alphabet in a get request, the server receives not the word hello (in this case), but a certain string @825B. Latin is ok. What is the matter and how to solve this problem?
const request = require('request')
request( ' https://site/hello ' function (error, response, body) { console.log(body) })

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Abcdefgk, 2018-02-08
@zhencowalencko

You can try to constwrite the canonical one instead. var
Or like this:

var str = encodeURIComponent('https://site/привет');
console.log(str); // https%3A%2F%2Fsite%2F%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82

S
skoval, 2018-02-07
@skoval

Try mailing it in a normally stamped envelope, without any hello there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question