1 Reply Latest reply: Mar 15, 2013 2:59 PM by gimbal2 RSS

    wrong character encoding in error messages

      The Java compiler can be adjusted to source file encoding with the option javac -encoding ...
      The Java runtime can be adjusted to terminal encoding with java -Dfile.encoding=...
      While this appears somehow inconsistent, it works and can be used e.g. when running the tools from Cygwin (the POSIX layer on Windows) which uses UTF-8 by default, while Java, following the Windows mechanism, uses some other character encoding by default (this works more seemlessly on Unix/Linux, by the way).

      Now if I compile UTF-8 source with non-ASCII characters, and there is an error message related to them, the error message printed to the console will not be UTF-8 encoded, resulting in mangled text output.

      (Arguably, source and terminal encoding could be different, but then there is no option available to the compiler to adjust this;
      it does not accept -Dfile.encoding=....)

      Example: Error message looks like this:
      FM.java:1: error: class, interface, or enum expected
      While the string is actually "bäh" in the source.

      This is a bug. Any proper place to actually report a bug?

      Edited by: 994195 on 15-Mar-2013 09:42