Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Encoding 8859_1 to 8859_7

 
Harish Kashyap
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i'm having a problem that how do i change the encoding of the text of characters when i transmit them through the sockets.
system uses the default encoding scheme(8859_1). but i want 8859_7 encoding scheme to control my outstream.
can anyone help me doing this.
thanx
harish
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
InputStreamReader and OutputStreamWriter allow you to specify whatever encoding you want in their constructors.

So for example to write to a socket using 8859_7 encoding:
<code><pre>
OutputStream os = socket.getOutputStream();
OutputStreamReader osr = new OutputStreamReader(os, "8859_7");
osr.write("This text gets encoded using 8859_7");
</pre></code>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic