Closed gendalf closed 8 years ago
@gendalf do you set the caller-name using Node.js or some other method (e.g. XML dialplan)? Just trying to reproduce the issue. (When sending UTF-8 in event headers from Node.js, I get %
-encoded responses, which produces garbage once they go through the module, but doesn't crash the parser.)
Also I'm going to have to make sure that using .setEncoding('utf8')
on the socket doesn't change things in unexpected ways, I'll feel more comfortable after I write a few tests to get a better handle on this. :)
I am set caller name in nodejs
person_name = "Толя Кротик" // cyrillic
When getting event in ascii (by default), body have json with ".... "variable_caller_id_name":"PP2P0QP5P=P: P>P.QP8P9P!P5QP3P5P5P2P8QP"P>P;Q PQP>QP8P:",... 'P"P>' - ops... error
when setEncoding('utf8') - all fine inside message, but FS send Content-Length in bytes, not in utf8 chars... so body parsing wrong when try get body with substring...
Thank you for the great report @gendalf ! Please test v4.1.0 and let me know if things are better!
Now it works fine! Great job @shimaore !
When set caller name in utf-8, event receipt in ascii and crush on JSON.parse
Need to read socket in utf8 encoding