Rick Mann wrote:
>However, building on the linux server, javac interpreted the source file as
>UTF-8, and of course the resulting output was incorrect.
A problem with a Java source file being compiled is not the same as a
problem with a Java program's output file. You should devise a solution
that solves only the problem at hand, rather than using a "bigger gun"
approach that could create new and more exciting hidden problems.
You can tell 'javac' to use a specific source-file encoding, and it will do
it regardless of platform. I suggest putting that in your build settings
or make-file or Ant-file or whatever you're using to build your code.
I also recommend running a filter on your source files (possibly as a
checkin prerequisite) that flags anything outside the range of 0x00-0x7E as
an error. That's a source-control mgmt issue. For example, I always and
only use \uXXXX escapes in source code, even when I know I can get away
with a MacRoman char. That's a developer discipline issue.
The error you stumbled on could just as easily go a different way: a
Windows box assuming cp1252 or 8859-1 would compile correctly on that
platform, but not on others. In other words, you need to tell the compiler
what to do on any platform, not force the host platform into a universal
setting.
By the way, you should also make sure that Eclipse or Xcode or vi or emacs
or whatever your developers edit with is compliant with your source-file
encoding. Otherwise it can very easily screw things up in the source,
though a checkin filter would at least backstop that mistake.
-- 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