mrniko / netty-socketio

Socket.IO server implemented on Java. Realtime java framework
Apache License 2.0
6.82k stars 1.65k forks source link

Utf-8 doesnt work in IE9 w/o forceJSONP=true #207

Closed alim-akbashev closed 9 years ago

alim-akbashev commented 9 years ago

Messages containing utf-8 (cyrillic for example) cause parse error on client in IE9 (without forcibly enabled jsonp)

mrniko commented 9 years ago

I just updated the netty-socketio-demo. You should set utf-8 charset as meta param in your html head section.

alim-akbashev commented 9 years ago

didnt help

mrniko commented 9 years ago

do you use 1.3.3 client?

alim-akbashev commented 9 years ago

yep

mrniko commented 9 years ago

(without forcibly enabled jsonp) how did you do that?

alim-akbashev commented 9 years ago

(without forcibly enabled jsonp) how did you do that?

i simply did not set forceJSONP: true in io.connect opts in that case socket.io.js uses b64=1 for IE9 (at least IE9, not sure about all other old browsers)

mrniko commented 9 years ago

i have tried both cases: var socket = io.connect('http://localhost:9092', {'forceJSONP': true}); and var socket = io.connect('http://localhost:9092', {'forceJSONP': false}); and didn't encounter any problems with utf-8 encoding.

alim-akbashev commented 9 years ago

ok, i'll retry again with latest version from master and will provide test project if issue still exists

alim-akbashev commented 9 years ago

IE9 with default opts:

ie9-default-opt

LOG: socket.io-client:manager readyState opening +2ms 
LOG: socket.io-client:manager open +232ms 
LOG: socket.io-client:socket transport is open - connecting +0ms 
LOG: socket.io-parser decoded 0 as %j +0ms[object Object] 
LOG: socket.io-client:manager error +17sError: server error 
LOG: socket.io-client:manager writing packet %j +6s[object Object] 
LOG: socket.io-parser encoding packet %j +23s[object Object] 
LOG: socket.io-parser encoded %j as [object Object] +0ms2["chatevent",{"userName":"user56","message":"ыыыыыы"}] 
LOG: socket.io-client:manager error +87msError: server error 

latest Chrome with opts {forceBase64: true, transports: ['polling']};: chrome

 engine.io-client:polling-xhr xhr data null +1ms
socket.io.js:1 socket.io-client:manager writing packet %j +6s Object {type: 2, data: Array[2], nsp: "/"}
socket.io.js:1 socket.io-parser encoding packet %j +6s Object {type: 2, data: Array[2], nsp: "/"}
socket.io.js:1 socket.io-parser encoded %j as Object +2ms 2["chatevent",{"userName":"user123","message":"бла"}]
socket.io.js:2 engine.io-client:socket flushing 1 packets in socket +7s
socket.io.js:2 engine.io-client:polling-xhr xhr open POST: http://socketio.dev/socket.io/?EIO=3&transport=polling&t=1423333172300-3&b64=1&sid=488054a6-e1c4-4375-8916-4b2a4462d270 +3ms
socket.io.js:2 engine.io-client:polling-xhr xhr data 57:42["chatevent",{"userName":"user123","message":"бла"}] +14ms
socket.io.js:2 engine.io-client:polling polling got data 57:42["chatevent",{"userName":"user123","message":"бла"}] +73ms
socket.io.js:2 engine.io-client:socket socket receive: type "error", data "parser error" +1ms
socket.io.js:1 socket.io-client:manager error +98ms Error: server error {code: "parser error", stack: (...), message: "server error"}

i guess no need to publish test project cuz i'm using master branch of backend without any changes + master branch of netty-socketio-demo with only changes - url

alim-akbashev commented 9 years ago

btw, this issue is fixed in my fork. hope it would be helpful for you, @mrniko

mrniko commented 9 years ago

Ready! i migrated to your processUtf8 ;)