Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect encoding/decoding #8

Closed
nuclearace opened this issue Mar 16, 2015 · 4 comments
Closed

Incorrect encoding/decoding #8

nuclearace opened this issue Mar 16, 2015 · 4 comments

Comments

@nuclearace
Copy link

Maybe I'm crazy but when doing

 console.log(new Buffer(utf8.encode("π"), 'utf8'))

> <Buffer c3 8f c2 80>

When I believe the correct encoding should be

<Buffer cf 80>

As Swift shows

@nuclearace
Copy link
Author

Found because my socket.io-client-swift's unicode messages are exploding inside of https://github.com/Automattic/engine.io-parser/blob/master/lib/index.js#L157

For example this string is what's being passed into decode

@nuclearace nuclearace changed the title Incorrect encoding Incorrect decoding Mar 16, 2015
@nuclearace nuclearace changed the title Incorrect decoding Incorrect encoding/decoding Mar 16, 2015
@nuclearace
Copy link
Author

Looking more closely, I believe this might be a problem with engine.io-parser

@mathiasbynens
Copy link
Owner

>  console.log(jsesc(utf8.encode('π'), 'utf8'))
\xCF\x80

https://mothereff.in/utf-8#%CF%80

I don’t see a problem here.

Please post a link to the engine.io-parser issue once you’ve filed it.

@nuclearace
Copy link
Author

socketio/engine.io#315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants