Where he blogs about his eclipse musings
Java and Unicode monday morning blues
Monday morning excitement. JUnit tests that pass in the IDE fail in ant and cruise servers running on all platforms.
java.lang.AssertionError:
Expected: a string containing "... text=Ç..."
got: "... text=Å..."
My immediate reaction was the encoding used by the JVM. Setting the “file.encoding” system property to UTF-8 did not help. Running the ant based tests in remote debugging mode also confirmed that the two strings were indeed different.
Since the tests used Cobertura for code coverage, the next step was to disable cobertura. Cobertura manipulates the generated byte code to add logging statements for code coverage. Still the same error.
The hidden gem seemed to be the -encoding java compiler flag. Setting it to UTF-8 fixed the problem.
So the next time you have something fail because of an encoding issue, it could just be the compiler encoding and not just the encoding used in the runtime!