-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 George,
On 5/28/2009 3:59 PM, George Sexton wrote: > The issue is the default character set for Java. I've noticed that at > least at one point in time, the default character set for Java running > under windows was Windows-1252. Running under Linux it defaults to > ISO-8859-1. That's a bold statement. $ uname -a Linux chadis 2.6.14-gentoo-r5 #2 PREEMPT Sat Dec 17 16:30:55 EST 2005 i686 AMD Athlon(tm) XP 1700+ AuthenticAMD GNU/Linux $ java -version java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing) $ java -classpath .. Env | grep file\.encoding= file.encoding=ANSI_X3.4-1968 That's ASCII, baby! > I'm sure the same issue is happening here. It's defaulting to > Windows-1256 on Arabic windows, on another OS it's defaulting to > ISO-8859-1 or perhaps ISO-8859-6. As Len points out, file.encoding should have nothing to do with this since the data source is a database. file.encoding is only used when converting bytes to characters and no encoding has explicitly been specified. The db driver should at least default to something (which /may/ be file.encoding but should probably default to whatever the database is actually using). > I ran into these kind of issues when I called the various String to Byte > Array functions, e.g. String.getBytes(). I was calling getBytes() and > then using a hash function for the result and getting different results > on different machines. That's because calling String.getBytes() is a bad idea. You should be using String.getBytes(String). > In short, there's no simple answer. You have to figure out step by step > where things are going wrong, and then address those issues. +1 > 1) Default Charset on each platform. - -1 > 2) Charset the database is declared with > 3) Charset of data coming in from db. +1 > 4) Charset of pages. Do the pages explicitly set the encoding to UTF-8? +0 : UTF-8 isn't the only game in town, but it's the only one worth playing :) This application wouldn't work on any system unless the page encoding had been explicitly set to something that contained Arabic characters, since the default JSP encoding is ISO-8859-1 which clearly does not contain such characters. I would also check the system you're on /for the browser/. I had a problem where one machine could properly render Chinese characters while another one couldn't: the server was 100% correct but the client was failing to display them properly. There's nothing the server can do about that! I would also check your database driver settings. If you use Tomcat to set up your database connection pool (using a <Resource> element in context.xml) then you may have different encodings set on different servers. Make sure that they are all the same (and I would highly recommend copying the one that /works/). Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkogpOUACgkQ9CaO5/Lv0PBIugCeOkeVDuR/TP0KsormCIyTfcUt tRgAn2xc4ohoLvJC3dcvyylHzhDpKGf3 =afO0 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org