OS X: Terminal output of javac is garbled.

Posted by Don Werve on Stack Overflow See other posts from Stack Overflow or by Don Werve
Published on 2010-03-15T02:16:22Z Indexed on 2010/03/15 2:19 UTC
Read the original article Hit count: 255

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about javac