This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Encoding 8859_1 to 8859_7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Encoding 8859_1 to 8859_7" Watch "Encoding 8859_1 to 8859_7" New topic
Author

Encoding 8859_1 to 8859_7

Harish Kashyap
Ranch Hand

Joined: Jun 14, 2000
Posts: 118
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

Joined: Jan 30, 2000
Posts: 18671
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>

"I'm not back." - Bill Harding, Twister
 
GeeCON Prague 2014
 
subject: Encoding 8859_1 to 8859_7