-
Notifications
You must be signed in to change notification settings - Fork 61
UTF-8 stopped working #21
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Whoops. I am not using the latest client. |
Still happens when using release 1.1.0 on both ends |
When sending multi-byte strings from client to server I see this exception:
|
The other way around results in garbled text in the browser, but no exception. |
It doesn't happen when using 1.0.5 (engine.io) on the server, even when using 1.1.0 on the client. |
I'd suspect ws is already dealing with the encoding/decoding internally, why the sudden need to use utf8? |
Please provide a failing example.
|
It's impossible to write a working example, but here's a failing one: |
So my suggestion is that when sending strings, just let the underlying implementation (http/websocket) handle them. I don't get why it would be necessary to do any encoding/decoding trickery on them yourself. |
bump. Just let me re-emphasize that it was working in previous versions (like 1.0.5) |
@binlain have you tried with the latest releases? It sounds like either the client or server has the utf8.js stuff, but the other doesn't. Your example worked for me with the master branches just fine. The reason we are using utf8.js is that when encoding mixed binary and string contents, we need to support multibyte strings. It is easiest to encode the multibyte characters so that we can do a transformation to a binary representation one byte at a time. |
Version 1.1.1 (client & server) is still completely and utterly broken. I can observe this in production as well as in this example which I suggest you try yourself. Engine.io was working perfectly. It got broken by trying to fix a problem that wasn't there. |
@binlain it was not working perfectly for all transports. For the situation I described above, we were not handling multibyte characters correctly. The engine.io.js build file is outdated in the current release, which is maybe why the file in your example is outdated too. @guille we should update the build. If I use a newly built engine.io-client (that I built myself in a working copy), everything works as expected in your example with engine.io 1.1.1. Here is a screenshot of the resulting alert. Indeed if I use the file that is currently in the repo, the text is garbled. |
Ah sigh. Thanks for clearing this up. |
We should just stop having the prebuilt file for engine and publish build instructions or point to the browserify CDN. |
just got hit by this bug. Thanks to @rase- I made a new build and it worked perfectly. |
@chirag04 good that you got it solved. :) |
1.2.1 tagged with the proper build |
Thank you all guys. This error took my whole day. ~~ |
utf-8 strings worked just fine before. Now they are broken.
Characters that are represented as multiple bytes now get split into individual characters.
The text was updated successfully, but these errors were encountered: