Re: Reading and writing files character encoding
Conrad D'Cruz <conrad.dcruz-QgKjmwvqNIVWk0Htik3J/[email protected]>
| Newsgroups | gmane.org.user-groups.trijug.juglist |
|---|---|
| Organization | Netswirl, Inc. |
| Message-ID | <[email protected]> |
Tony, Are you using InputStream or InputStreamReader? InputStreamReader allows you to specify a character set and decoder. I believe, the default is "US-ASCII". In some applications I had to explicitly specify "ISO-8859-1". Also, try the "UTF-16" and see if that solves the problem. I usually reference the Charset documentation which gives several choices ... http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html Send a summary of your results. Thanks Conrad Tony Spencer wrote: > Hi, > I am attempting to read a simple XML feed over HTTP and write it to my > local disk. The feed has some spanish in it so there are non-US > characters present. Currently I use a BufferedReader and InputStream > to read the feed and I write it to disk with FileWriter. The problem > is that the non-US characters (such as the second character in this > provice http://en.wikipedia.org/wiki/Malaga) are mangled in the local > copy that is written. > > Can someone explain how to deal with different character encodings in > cases such as this? Do you need to know the encoding of the content > you are receiving? > > Thanks, > Tony > ------------------------------------------------------------------------ > > _______________________________________________ > Juglist mailing list > [email protected] > http://trijug.org/mailman/listinfo/juglist_trijug.org >