Is encoding differs various platform

Hi all,

I have one basic query. Does java character encoding differs from OS to OS.

Say for example i run a program that encodes a ascii to UTF-8 format.

I see different outputs when comparing WINDOWS and LINUX.

If UTF is a standard for representing a character how can it differ.

Thanku.

[327 byte] By [balajii_Aa] at [2007-10-2 16:14:55]
# 1

UTF-8 is UTF-8 no matter which platform you use. If you see different output on Linus vs. windows I would suspect that the source is different or that the code you run is the cause.

I am not sure what you mean by

>>encodes a ascii to UTF-8 format.

Exactly what do you do? Depending on your code, the differences you are seeing could be related to the default encoding on the platforms, etc. Imposible to tell without knowing what it is you do.

one_danea at 2007-7-13 17:04:04 > top of Java-index,Desktop,I18N...
# 2

The platform default character encodingthat is, the character encoding that java uses by default to read and write text files and to convert characters to bytes and bytes to charactersdepends on the system. On Windows in a western setup it's usually Windows-1252 or "CP1252." On Linux and Macintosh it depends on the user's language settings.

Individual fixed character encodings are platform independent. A UTF-8-encoded text file is a UTF-8-encoded text file everywhere.

See here how to use a fixed encoding (rather than the default) for reading and writing files:

http://javaalmanac.com/egs/java.io/ReadFromUTF8.html

http://javaalmanac.com/egs/java.io/WriteToUTF8.html

jsalonena at 2007-7-13 17:04:04 > top of Java-index,Desktop,I18N...