Good day to all posters and lurkers, I have a problem with accents that is occurring when I run Tomcat 4.1 under JVM 1.3.1, but not under 1.4. I am trying to convert a byte[] (that comes from a socket in the production code) to a String. The bytes come from a CGI and are ISO8859-1. When I do String(myByteArray), I get a question mark character where I should get an accented character. Following some advice picked up from the web, I have forced the JVM to start with a file.encoding=ISO8859_1. This works perfectly when running Blackdown 1.4 but fails when using Blackdown 1.3.1. Here is a demo JSP: ------------ Convert a byte: <%= new String(new byte[]{(byte)''}) %>
Convert ISO: <%= new String(new byte[]{(byte)''}, "ISO8859_1") %>
Encoding: <%= sun.io.ByteToCharConverter.getDefault() %>
Locale: <%=java.util.Locale.getDefault()%> ------------ Here is the CATALINA_OPTS used: -Dfile.encoding=ISO8859_1 -Duser.language=fr -Duser.region=CA" If I do a Sytem.getProperty("file.encoding"), I get ISO8859_1 in both JVM, but sun.io.ByteToCharConverter.getDefault() - which is what String(byte[]) uses - says ASCII for JVM 1.3 and ISO8859_1 for JVM 1.4. It would also seem this is not the only setting getting ignored by the 1.3 JVM... The language and region settings result in a locale of fr_CA for 1.4 but are ignored (and default to en_US) for 1.3 I know I could simply force the encoding as I did in line 2 of the JSP, but I am trying to migrate a whole lot of code from Websphere to Tomcat that was written by many developers and would rather not seek out all instances of byte arrays being converted to strings. Moreover, I suspect this is merely the tip of the iceberg and other occurrences of accents being garbled might be going on in less obvious places. I also could just use version 1.4 of the JVM, but the only widely available .deb for JVM 1.4 is a BETA. If at all possible, I'd like to use a production release managed by the debian package manager and picked up from official Blackdown mirrors... Could anyone offer a suggestion? Alex --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org