I've got my computer set up in Japanese (hey, it's good language practice), and everything is all fine and dandy... except javac
. It displays localized error messages out to the console, but they're in Shift-JIS, not UTF8:
$ javac this-file-doesnt-exist.java
javac: ?t?@?C??????????܂???: this-file-doesnt-exist.java
?g????: javac <options> <source files>
?g?p?\?ȃI?v?V?????̃??X?g?ɂ??ẮA-help ???g?p???܂
If I pipe the output through nkf -w
, it's readable, but that's not really much of a solution:
$ javac this-file-doesnt-exist.java 2>&1 | nkf -w
javac: ファイルが見つかりません: this-file-doesnt-exist.java
使い方: javac <options> <source files>
使用可能なオプションのリストについては、-help を使用します
Everything else works fine (with UTF8) from the command-line; I can type filenames in Japanese, tab-completion works fine, vi can edit UTF-8 files, etc. Although java
itself spits out all its messages in English (which is fine).
Here's the relevant bits of my environment:
LC_CTYPE=UTF-8
LANG=ja_JP.UTF-8
From what it looks like, javac
isn't picking up the encoding properly, and java
isn't picking up the language at all. I've tried -Dfile.encoding=utf8
as well, but that does nada, and documentation on the localization of the JVM toolchain is pretty nonexistent, at least from Google.
Addendum:
Macports OpenJDK6 has better behavior:
$ /opt/local//share/java/openjdk6_bootstrap/bin/javac this-file-doesnt-exist.java
javac: file not found: this-file-doesnt-exist.java
Usage: javac <options> <source files>
use -help for a list of possible options