Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues with Extended Characters using Files and Runtime.exec (especially in 1.5)



Michael Macaluso wrote:

>After investigating what the open command receives as the parameter, it
>appears that the 1.5 VM has reverted from the UTF-8 (in < 1.5) encoding to
>the MacRoman encoding.

It that's what it's doing, it is very badly wrong.  The standard
text-encoding for command-line args is UTF-8.  There's even an Apple
reference that says so, but I can't cite a URL for it off the top of my
head.  It's probably one of the BSD system-call or function references.
The text-encoding of file-contents is a different matter, as is composed
vs. decomposed accents.  But MacRoman command-line args?  No freakin' way!

Approximately zero exec()'able commands expect MacRoman command-line args,
nor understand it as such when they receive it.  As the lone exception in
my experience, the 'osascript -e ...' command will interpret its
command-line script text as if it were MacRoman, even when it's encoded in
UTF-8.  This makes for lots of fun debugging 'osascript -e' command-lines,
and is more likely a bug than an intentional feature.


I suspect that something may have changed which had been using UTF-8 and
started using the "file.encoding" property (i.e. the "default encoding"),
rather than an Apple engineer making an actual decision to intentionally
convert to MacRoman.

To test this hypothesis, please try the following:
  java5 -Dfile.encoding=UTF8 ExtendedCharacterTests

where 'java5' is whatever you use now to run the 1.5 'java' command rather
than 1.4.

If the hypothesis is correct, then this line in the source should work:
  OpenFile("Hello\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0.txt");

If the hypothesis is incorrect, then the test case should continue to
malfunction as you described.


I also suggest trying the new 1.5 DP7, to see if the problem is still
present.  If so, please send an urgent email to Apple that this is badly
broken and desperately needs fixing before final release.  If the problem
is fixed, then all I can say is "Whew!".  The kluge of writing to a temp
scriptfile, then chmod'ing and exec()'ing it as a work-around is too
hideous to contemplate.  The creeping, flopping, loathsome horrors of H. P.
Lovecraft would feel right at home with such an execrable monstrosity.  I
commend your fortitude at putting up with such a beast.

  -- 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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.