Hello,
I have two applications working in a client/server mode. The client is
written in C++ running on a Linux box. The server is an applet and was
written on a Linux box with NetBeans 3.6.
When the client send a message, which is a string, containing some
information plus a image (JPEG format) I can decode evrything and
display the image on a Linux box running the applet (I'm using
Firefox).
But when I use a machine running Windows the image looks corrupted
(with IE or Firefox). It's strange since the data are the same (Java is
suppose to be cross platform). I read a document about the charsets but
I don't know how should I apply it. Which are the charsets available on
windows and which one should I apply? Should I applly the one use by
the client machine (running on the Linux box)?
Anybody have an idea?
Here is a snapshot of the code to get the image out of the string on
the server:
<--------------- Start here -------------------------->
String strdata = m_inputStream.readLine();
String str1 = strdata.replaceAll("firstReplacement","\n");
String str2 = str1.replaceAll("secondReplacement","\r");
String str3 = str2.replaceAll("thirdReplacement","\r\n");
byte data[] = str3.getBytes();
<--------------- end here -------------------------->
When using the getBytes() should I specify the the charsets.
Thanks for your help,
Best regards.
Alain-Serge
Boudewijn Dijkstra - 22 Jun 2005 17:31 GMT
> When using the getBytes() should I specify the the charsets.
Have you tried that?
asn - 22 Jun 2005 23:27 GMT
No yet. Before going in that I would to know if is to good path.
Boudewijn Dijkstra - 25 Jun 2005 14:20 GMT
> No yet. Before going in that I would to know if is to good path.
There's nothing wrong with trying something out. And getBytes() is known to
be platform-sensitive.