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: Setting system-wide encoding?




On Dec 7, 2006, at 3:33 PM, Rick Mann wrote:


On Dec 7, 2006, at 03:04 , Michael Hall wrote:

What problems do you actually have with MacRoman? If you aren't running into it's probably a 'if it ain't broke don't fix it' situation isn't it? It's a risky change since you might mess things up for all jvm's. If it doesn't fix a problem why do it?
I don't think there is a way to change this for the scope you want. If there were it would probably be located in a properties file somewhere like
/System/Library/Frameworks/JavaVM.framework/Home/lib
it will probably require root permissions to make any changes if you do find a properties setting to control this. I'd still suspect there isn't one.

The problem is that it's hard to catch errors in file encoding. For example, one of our developers was writing strings containing the copyright symbol. The file encoding was MacRoman, and because she was on a Mac, the java compiler (correctly) assumed that the file was MacRoman and generated code that ended up outputting a MacRoman- encoded copyright symbol. The code ends up outputting a UTF-8 encoded byte stream, and so on her machine the webapp behaved correctly.


However, building on the linux server, javac interpreted the source file as UTF-8, and of course the resulting output was incorrect.

Had the Mac been assuming UTF-8 everywhere, this problem would've been detected very early, and hours of hunting might've been avoided.

If the developer wrote the software correctly it would not make any assumptions about the encoding and be explicit in choosing an encoding when going in and out of String instances, etc. It is generally a bad programming practice to use the default encoding on any platform.


If I could set the file encoding system-wide, then javac would also use the right encoding.

I don't see why Mac OS X still has MacRoman encoding in the jvm...

Mac OS X had/has to support users coming over from Mac OS. Mac OS used Mac Roman as its default encoding. That is why the default encoding was selected to be Mac Roman on Mac OS X.


-Shawn
_______________________________________________
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
References: 
 >Setting system-wide encoding? (From: Rick Mann <email@hidden>)
 >Re: Setting system-wide encoding? (From: Michael Hall <email@hidden>)
 >Re: Setting system-wide encoding? (From: Rick Mann <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.