-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I am using ZK 3.5.2 and JBoss 4.0.2.
I changed the JBoss command to include: -Dfile.encoding=windows-1255 (for the Hebrew language), unfortunately it did not solve the problem and the language resources was not loaded correctly (it used UTF-8 to parse the properties file).
To solve the problem I modified the Maps class to use the default character set if it did not received any (that is the case when loading language properties - it always pass null to the character set parameter) as followed:
public final static void load(Map map, InputStream sm, String charset, boolean caseInsensitive) throws IOException { final PushbackInputStream pis = new PushbackInputStream(sm, 3); if (charset == null || charset.startsWith("UTF")) { final byte[] ahead = new byte[3]; int n = pis.read(ahead); if (n >= 2 && ((ahead[0] == (byte)0xfe && ahead[1] == (byte)0xff) || (ahead[0] == (byte)0xff && ahead[1] == (byte)0xfe))) { charset = "UTF-16"; //don't eat UTF-16 BOM, since Java use it to know endian } else if (n == 3 && ahead[0] == (byte)0xef && ahead[1] == (byte)0xbb && ahead[2] == (byte)0xbf) { charset = "UTF-8"; n = 0; //eat UTF-8 BOM since Java won't handle it } else if (charset == null) { // original line: charset = "UTF-8"; charset = java.nio.charset.Charset.defaultCharset().displayName(); } if (n > 0) pis.unread(ahead, 0, n); } : : : }
I do not know if this is a bug or there is another way to do it.
Hanan.
Hi HananW,
This is the way you use to get the charset,
charset = java.nio.charset.Charset.defaultCharset().displayName();
Hi Ryan,
I do not think the problem in with JBoss, since if you look at my message you will see that only after I Added the code you suggested to a ZK class thing start to work.
So my logic is that if I had to change a ZK class one of two possibilities exists:
1. There is a bug in ZK (and not in JBoss).
2. There is a different way to do what I wanted.
Since I did not see any other way, it seems to me that this is a ZK bug.
Regards,
Hanan.
Asked: 2009-01-24 09:15:42 +0800
Seen: 173 times
Last updated: Feb 22 '09