[Jslib] Questions about socket & encoding

Hanh-Missi Tran tran at grappa.univ-lille3.fr
Mon Jul 4 18:00:26 EDT 2005


Hi

I have used the file socket.js to write a Firefox extension that 
communicates with a Java server. I want my extension to send UTF-8 
strings to the server and to receive UTF-8 strings from the server.

When I send data by writing:
var aString='example';
socket.write(aString);
The data my server receive is not a UTF-8 string. What is the charset of 
the data sent to the server ? The charset of a Javascript string (UTF-16 
Unicode?) ? Or is there an encoding of the data before it is sent ?

When I receive data and when I want to see the value of the data:
var message = socket.read(10);
alert(message);
the data is not well displayed. What is the encoding to use (from which 
charset to which charset) ?

Thanks for your help.



More information about the Jslib mailing list