danneu / kog

🌶 A simple Kotlin web framework inspired by Clojure's Ring.
43 stars 4 forks source link

String encoding - Broken with special chars like: äöüß etc. #23

Closed ThraaxSession closed 7 years ago

ThraaxSession commented 7 years ago

Hi @danneu I have a problem with special chars. When I serialize data in JSON and transmit the data to the websocket service, I get only ? back.

Can you help me with it?

Thank you and best regards Gino

danneu commented 7 years ago

@GinoHereIam I'll look at it right now.

danneu commented 7 years ago

Can you go into more detail about the issue?

When I launch kog's websocket example (I just updated it), I can't see any issues when I socket.send() from the browser JS console:

server said: hello world
> socket.send('äöüß')
server said: äöüß
> socket.send(JSON.stringify({foo: 'äöüß'}))
server said: {"foo":"äöüß"}

Where are you seeing ? instead of the chars?

ThraaxSession commented 7 years ago

Oh damn sorry.. it's not websocket... it's the encrypted word what looks only weird:

[beb64fe5-4a6e-461d-bf53-d86ed60fa9a1] client sent us: {"actionType":"USER_REGISTER_ACCOUNT","name":"Gino","username":"GinoHereIam","password":"ÄöäÜä!","content":"","token":""}
Encrpyted password: 2���D��n��v�����>��˦l_�

I hope it didn't take you too much time.