Notes |
|
(0005567)
|
ferg
|
10-20-11 09:59
|
|
The encoding for WebSocket is always utf-8. It has nothing to do with the character-encoding.
If you have a bit of sample code where Resin's text isn't producing utf-8, that would be helpful. |
|
|
(0005568)
|
ihristov
|
10-20-11 13:15
|
|
I don't want to be picky nor impolite but "<character-encoding> specifies the default character encoding for the environment." sounds to me quite important and having a lot to do with servlets character encoding stuff. Anyway, the problem can be easily reproduced by the following recipe:
1.) Implement the WebSocketListener interface to provide a websocket server-side logic. Something like:
public void onReadText(WebSocketContext context, Reader is) {
System.out.println("Msg received: "+ org.apache.commons.io.IOUtils.toString(is));
}
2.) Develop a small client to connect to the WebServlet (Unitt framework can be useful here, http://code.google.com/p/unitt/) [^]
3.) Send some text messages and see what happens. Also verify that the Reader is using ISO-8859-1.
Suspiciously enough, I can see in the ReaderStream class a small note over the read method which goes like this:
// XXX: encoding issues
I hope that this is helpful to you and puts you on the right track.
I have to check if Resin is producing text using ISO-8859-1, so far I had no troubles with server -> client communication, thus I have not verified.
Cheers,
Ivan |
|
|
(0005569)
|
ferg
|
10-20-11 14:10
|
|
server/1o36
The issue was with the read(char[]) call in WebSocketReader.
WebSocket encoding is required to be utf-8 by the WebSocket spec. It cannot be changed by any implementation. Because the WebSocket spec has a specific encoding, default character encoding does not apply. |
|