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?
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.