user547453
user547453

Reputation: 1045

Reading files in UTF-8 in any Windows OS

I am writing a string to a file that has characters like Ԉ and ف.

I want to specify the encoding as UTF-8 and hence I am forced to convert it to bytes, instead of writing as characters, either using OutputStreamWriter or .getBytes("UTF-8").

I am able to save and read the file (and do a sysout in Eclipse console). Of course if I set the file encoding property in Eclipse as UTF-8, I do see my characters like Ԉ and ف.

Now my question is, instead of printing these characters to my console if I pass it to a text field within my Swing application, will it still correctly display the characters? If I distribute my Swing application to another person in Europe (different Windows charset map), will it also correctly display the characters?

Upvotes: 0

Views: 397

Answers (1)

Stephen C
Stephen C

Reputation: 718698

You should be fine. AFAIK, the Java APIs for displaying text in a Swing API are not sensitive to the native OS default character encoding / map.

Upvotes: 4

Related Questions