Problem with scandinavian letters moving from SDK 1.2.2 to 1.3.1

Im working on a J2ee project with servlets, JSPS and EJBs. We recently switched from using SDK 1.2.1 to SDK 1.31, as we did this in our development environment (Windows NT) everything worked fine but when we did the same in oour production environment (Solaris) the scandinavian letters started showing up as ' ' or as '?' in some places but not all, the showed up correctly when coming for example from a ResourceBundle but showed up wrong when being read in from a file. I tried to use the old(1.2.1) font.properties file and i18n.jar instead of the ones that came with version 1.3.1 but this did not help, any suggestions? All help appreciated!

[665 byte] By [tgrano] at [2007-9-26 1:56:14]
# 1
Can you explain what "showing up" means? I assume you mean the characters are displaying badly somewhere, but where? In a GUI? In a browser? In a console app?
DrClap at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 2
I read in a textfile to memory, the textfile on disk contains scandinavian letters but after the file is read and written back the scandinavian letters have been switched to '?' or ''.
tgrano at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 3

It sounds as if 1.3 uses a different (probably "improved") method of finding out what your default locale is, and so the "default encoding" for your files is different too. Your text files contain Scandinavian letters in what encoding? Perhaps it is ISO-8859-1, or cp1252? If you don't know how to answer that question, start at http://www.czyborra.com/ and follow the many links that explain text encodings. When you have the answer, make sure that you read your text file via some method that involves an InputStreamReader, where you can specify the encoding used to translate from bytes to characters. Likewise, use an OutputStreamWriter with a specific encoding to output your text. Finally, if you want to know what Java thinks your default encoding is, create an InputStreamReader with no encoding specified and look at the output of its getEncoding() method.

DrClap at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 4

I tried specifying the encoding to be ISO-8859-1 but that didnt help, still no Scandinavian letters. I guess I ll just have to try and find the right one. Java seems to think that the default encoding should be ASCII and then of course there are no scandinavian letters.

How do I define what Java should use as its default locale manually? Is this even possible...

tgrano at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 5

Jeg havde et lignende problem og vha svar p dit sp rgsml kunne jeg endelig l se problemet.

Ved lsning skriv:

BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"ISO-8859-1"));

Den modsatte vej:

PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(resultFile),"ISO-8859-1"));

mvh

simon

saxelsen at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 6

Biztosak vagyunk abban, hogy a latin1 (ISO_8859-1) kdol s tartalmazza a skandinv nyelvek betűit?

Or for those who do not understand the text above:

Are you sure latin1 contains the Scandinavian characters?

ISO_8859-1(7)Linux Programmer's ManualISO_8859-1(7)

NAME

iso_8859-1 -

the ISO 8859-1 character set encoded in octal, decimal, and hexadecimal

ISO 8859 Alphabets

The full set of ISO 8859 alphabets includes:

ISO 8859-1west European languages (Latin-1)

ISO 8859-2central and east European languages (Latin-2)

ISO 8859-3southeast European and miscellaneous languages (Latin-3)

ISO 8859-4Scandinavian/Baltic languages (Latin-4)

ISO 8859-5Latin/Cyrillic

ISO 8859-6Latin/Arabic

ISO 8859-7Latin/Greek

ISO 8859-8Latin/Hebrew

ISO 8859-9Latin-1 modification for Turkish (Latin-5)

ISO 8859-10Lappish/Nordic/Eskimo languages (Latin-6)

ISO 8859-11Latin/Thai

ISO 8859-13Baltic Rim languages (Latin-7)

ISO 8859-14Celtic (Latin-8)

ISO 8859-15west European languages (Latin-9)

ISO 8859-16some east European languages (Latin-10)

BIJ001 at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...
# 7
As I wrote (in Danish), ISO-8859-1 solved my problems reading/writing scandinavian letters. According to the list supplied, Latin-4 should also do the job, so I'm not surprised if other charsets also solve the problemsimon
saxelsen at 2007-6-29 3:11:13 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...