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 5: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 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...

What other platforms use UTF-8? I thought this tended to be the preferred latin encoding. Might be wrong.
Someone could still correct me if wrong but I don't think it can be user changed for all JVM's.
That might also introduce bugs where you develop for one encoding but all your users have another. Or have strange side effects for other java applications.
javac -encoding maybe for the build?



Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative



Attachment: smime.p7s
Description: S/MIME cryptographic signature

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