Why does the FileWriter not look at system "file.encoding" property?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   vineet_bhatia
Posted On:   Thursday, May 23, 2002 02:47 PM

We use the FileWriter object to write out files. In our application we set the system property "file.encoding" to UTF8 - System.setProperty("file.encoding", "UTF8"); This seems to work for String's and other objects. But, we are not able to write japanese characters using the FileWriter object. We see ????? in the file. Doing a getEncoding() on the FileWriter object gives Cp1252, which is the windows default encoding. Why is the behaviour of FileWriter object like this? Thanks in advance.    More>>

We use the FileWriter object to write out files.




In our application we set the system property "file.encoding" to UTF8 -



System.setProperty("file.encoding", "UTF8");



This seems to work for String's and other objects.

But, we are not able to write japanese characters using the FileWriter object. We see ????? in the file.


Doing a getEncoding() on the FileWriter object gives Cp1252, which is the windows default encoding.



Why is the behaviour of FileWriter object like this?



Thanks in advance.

   <<Less

Re: Why does the FileWriter not look at system "file.encoding" property?

Posted By:   Michael_Buck  
Posted On:   Thursday, May 23, 2002 03:43 PM

The file.encoding system property is read-only. See http://developer.java.sun.com/developer/bugParade/bugs/4397522.html.


To write Japanese characters use an OutputStreamWriter.

About | Sitemap | Contact