----- Original Message -----
From: "Greg Guerin" <email@hidden>
To: "list Java-dev" <email@hidden>
Sent: Thursday, August 21, 2008 10:04 AM
Subject: Re: MacOS 10.4.11 Character problem
zhangzehao wrote:
And, using "java -Dfile.encoding=UTF8" can resolve my problem,
but I set the file.encoding "System.setProperty('file.encoding',
'UTF8')" in my app, that can not be usefull.
What the difference bettween these?
The difference is due to timing, specifically, the point in time when the
value of "file.encoding" is used.
The JVM executes a significant amount of Java code before your main()
method is ever called. That code happens to use the value of the
"file.encoding" property to load a class and store it in a static
variable. After that point, the value of "file.encoding" is not read
again, so changing it in your app's main() will have no effect.
You can find where "file.encoding" is used by searching the source of the
JVM classes for "file.encoding". For example, there is a use in
java.nio.charset.Charset.
There is another use in the class java.lang.ProcessImpl, and it may be
related to the bug you're seeing when 'ditto' is exec()'ed. Look at the
method getEncodedBytes(), and also see the other methods that call it. I
could be mistaken, but getEncodedBytes() just seems wrong to me, not
least because it doesn't account for "file.encoding" values other than
"MacRoman". Or maybe this code isn't used any more, or ProcessImpl's
source is wrong.
In any case, I recommend filing a bug-report on the exact problem you are
seeing.
Be sure to include steps to reproduce the problem for someone who might
not know anything about Chinese writing systems. You might have to write
a Java program as the file generator using Unicode escapes for the
Chinese characters (\uxxxx). I had to do that once with a bug that
involved multiple accented characters in a row, because it was only the
Java code that malfunctioned.
You can get the source for the Java API classes by logging into ADC and
downloading the Developer Documentation from Downloads > Java.
Not necessarily. "DP7" means "Developer Preview 7". This just
identifies it as the seventh preview of that product release cycle from
Apple.
1.5.0_07 identifies the Sun build of the JVM. If there were enough DP
builds of 1.5.0_13, the seventh preview would be called "DP7", even
though it's for the 1.5.0_13 JVM build.
Notice the lack of correlation between Java Release numbering, and
"java.version" or "java.runtime.version" numbering. A similar thing
happens with DP numbering.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden