I have a servlet to turn out some values in a CSV file. Everything works fine except that in some cases the file can have special German characters and the Euro symbol. When I download the file and open in Notepad, everything looks fine (using UTF-8 encoding). When opening in Excel however, it does not. I have read in other forums that Excel does not like UTF-8, but I can't find a way to encode it that Excel does like.
The content being output is represented in the code as a String (parsed from a Velocity template). I saw something somewhere that Strings and byte arrays behave differently.
There has to be a way to handle this. Is there some conversion on the content I should do prior to outputting?
Any help appreciated.
Joined: Jan 21, 2002
I download the file from two machines with two different results. On my Windows desktop, the file looks fine in notepad and Excel. When I move the servlet to a Solaris box, it renders fine in notepad, but the euro symbol is not displayed correctly in excel. The difference (or the only difference I have found so far) seems to be related to the "file.encoding" system property. On Windows it is "cp1252" and on Solaris it's coming as "ISO8859-15", which I think was changed from the default (whatever it was) by a sysadmin.
subject: Character encoding with German chars & euro other than UTF-8