Home Ask Login Register

Developers Planet

Your answer is one click away!

user1382181 February 2016

Can be java virtual machine influenced by missing national languge support in Linux?

I don't have Linux. My program in Java reads an ANSI coded text file created under Windows XP in my national language. It worked properly under Windows XP. I'am interested if pure Linux can process such program. Thanks in advance!


Dolda2000 February 2016

The Java VM is certainly affected by language and locale settings, but just in what ways, if any, your program is affected depends on the program. String literals, for example, are stored in Unicode in the compiled program, so they will remain as compiled under all circumstances.

In your case, you seem to be interested in how InputStreamReaders and the like behave, and that depends on how you create them. If you create an InputStreamReader without any of the charset arguments, it will use the JVM's conception of "the default charset", which depends on the locale settings. If, on the other hand, you pass an explicit charset when creating them, they will behave the same no matter what platform and locale settings you run the program on.

For the record, a FileReader (if that is what you use) always uses the default charset.

Post Status

Asked in February 2016
Viewed 1,860 times
Voted 6
Answered 1 times


Leave an answer

Quote of the day: live life