|
-
April 12th, 2010, 02:42 PM
#2
Re: InputStreamReader, Charsets, and a surprise character
It all depends on how the XML is encoded on the other end. Reading the API for InputStreamReader shows that there are several encoding names available to help specify the encoding type.
- 8859_1 (ISO-8859-1/Latin-1)
- 8859_2 (ISO-8859-2/Latin-2)
- 8859_3 (ISO-8859-3/Latin-3)
- 8859_4 (ISO-8859-4/Latin-4)
- 8859_5 (ISO-8859-5/Latin-5)
- 8859_6 (ISO-8859-6/Latin-6)
- 8859_7 (ISO-8859-7/Latin-7)
- 8859_8 (ISO-8859-8/Latin-8)
- 8859_9 (ISO-8859-9/Latin-9)
- ASCII (7-bit ASCII)
- UTF8 (UCS Transformation Format-8)
Personally, I used for a project the following:
InputStream io = new BufferedInputStream(new FileInputStream(l_file));
InputStreamReader ir = new InputStreamReader(io,format);
Where the "format" variable was a String that was either "8859_1" or "UTF8", depending on how the file sent was encoded.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|