requestify icon indicating copy to clipboard operation
requestify copied to clipboard

JSON encoding breaks on post data with foreign characters

Open arush opened this issue 11 years ago • 7 comments

Are you using ascii instead of utf8 somewhere? Try sending a post request with a foreign char e.g. "ø" - json encoding breaks.

arush avatar Oct 27 '13 18:10 arush

Hey, Sorry for the late answer, I was on-board.. Actually and only thing I'm using is UTF8 with standard JSON.stringify, and I just tried it and could not reproduce, can you give me an example?

ranm8 avatar Nov 04 '13 06:11 ranm8

Hi,

I'm also having this issue. I'm trying to send JSON that contains foreign characters and I'm getting:

{ [Error: socket hang up] code: 'ECONNRESET' }

Something as simple as this causes it to break for me:

requestify.post(serverURL, { test: 'ö' }).then(function(request) { ... });

and my web server says:

[Fri Nov 29 18:22:31 2013] 127.0.0.1:52214 Invalid request (Malformed HTTP request)

Any ideas?

jesperlindstrom avatar Nov 29 '13 17:11 jesperlindstrom

Hey, Sorry for the late answer... I'm trying that with a simple node server and plays nicely... What web server do you use?

ranm8 avatar Dec 16 '13 13:12 ranm8

Hi. The web server was the native PHP 5.4 development server ($ php -S host:port), using Laravel framework... I believe I solved this issue by switching to a different request module after all. Not sure why it was happening.

jesperlindstrom avatar Dec 16 '13 13:12 jesperlindstrom

OK, can you please let me know what request module you've used after all?

ranm8 avatar Feb 10 '14 11:02 ranm8

I used mikael/request instead.

jesperlindstrom avatar Feb 10 '14 12:02 jesperlindstrom

I also have this problem, sending a query to elasticsearch via requestify's POST causes errors.

E.G.

requestify.post(url, {"query": "à"})

Doing it with other http clients (including the above mentioned mikael/request) does not yield any problem.

dariobanfi avatar Aug 19 '16 11:08 dariobanfi