Projects tigase _server server-core Issues #1381
web browser complain bad message format if there are Chinese characters (#1381)
Closed
Unknown opened 5 years ago

Describe the bug In web browser client(i use converse), if there are Chinese characters , the xhr.responseText would be truncated, both in chrome and firefox. the xhr.reponseText would be like this

<body xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0" xmlns="http://jabber.org/protocol/httpbind" ack="1398247530" xmlns:stream="http://etherx.jabber.org/streams" from="dev.willbe.xyz" secure="true" host="dev.willbe.xyz"><message type="chat" xmlns="jabber:client" id="id9987623c-3141-48ed-b687-9f76a3247b24" from="test4@dev.willbe.xyz/converse.js-64250860" to="admin@dev.willbe.xyz"><body>测试2</body><active xmlns="http://jabber.org/protocol/chatstates"/><request xmlns="urn:xmpp:receipts"/><origin-id xmlns="urn:xmpp:sid:0" id="id9987623c-3141-48ed-b687-9f76a3247b24"/></message></bod

notice the characters truncated at the end is exactly the same with the number of Chinese characters in the body.

To Reproduce

  • User web client (i use converse.js) , the problem is related to BOSH/HTTP protocol
  • send messages with Chinese characters

Expected behavior Message can be received , but it's not

Unknown commented 5 years ago

The issue is caused by the miscaculated HTTP Header Content-Length in http protocol content, which is related to character encoding. When i increase the content-length by the number of chinses characters in body, the message then can be received correctly.

issue 1 of 1
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1381
Please wait...
Page is in error, reload to recover