jQuery in Action, 3rd edition
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

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.
Jim Yingst

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:
OutputStream os = socket.getOutputStream();
OutputStreamReader osr = new OutputStreamReader(os, "8859_7");
osr.write("This text gets encoded using 8859_7");

"I'm not back." - Bill Harding, Twister
I agree. Here's the link: http://aspose.com/file-tools
subject: Encoding 8859_1 to 8859_7
It's not a secret anymore!