-
Notifications
You must be signed in to change notification settings - Fork 839
EOF error when sending non-UTF-8 strings #376
Comments
Not easy to implement, because of how the encoding works into an engine io payload and the fact that JavaScript actually uses UTF-16 encoding for strings. I've got it working as proof of concept in a side project of mine though, so it is possible. |
I take it this only happens when not using something like JSON that encodes UTF-8 characters? |
Yeah, this happens when you have raw utf-8 data. |
@erkie The biggest problem is actually that JavaScript uses UTF-16 and engine.io payloads contain the data size. I built a small proof of concept library that handles it, though it is horrible performance wise. |
I have no idea about performance but changing the Read method in payload/decoder.go to below code works:
The works by scanning the read bytes for unicode header bytes and then adding additional bytes onto the limit reader. I may have to also change the encoder, but I will look at that soon :) This code and a bunch of other changes are over at my fork https://github.com/grahamjenson/go-socket.io, where I also am writing a client and fixing other issues (like Ack packet decoding...) |
The above doesnt quite work. The differences between UTF8 and UTF16 are annoying. I got something working, but pretty sure it will only work in most cases (It is really annoying problem, which is wy EIO v4 looks much better. Decoder
Encoder
|
Fixed(ish) with #608 |
When you sent non-English msg in events, It printed "EOF" because it does not support UTF-8 format. please fix it.
Thanks
The text was updated successfully, but these errors were encountered: