Hi Erik,

> I am having trouble understanding a mystery.
> 
> I have code that checks my .properties file to make sure that it has not 

> been corrupted after being edited by a non UTF-8 editor. In particular I 

> have a property called lambda = λ and I check to see that it actually 
> does resolve to the correct character.
> 
> If I run my code from main (my manual unit test) it works. If I run my 
> test from JUnit in Eclipse, it works. But when the same test runs under 
> Maven it fails because lambda = ?

I can understand your use case, and we have had similar problems in our 
department: Code was (is) built and tested locally on Windows PCs, but in 
production runs under AIX. From time to time we had problems with German 
umlauts because some guys hardcoded them in their Java code...

The only solution that works cross-platform not only from within Java 
files, but also from property files is to replace non-ASCII-characters by 
their Unicode value.

Example:

before:  String str = "Schließen";              // ^= "close"
after:   String str = ""Schlie\u00DFen";

Doesn't look as nice as before, right, and isn't directly readable, but 
prevents you from such troubles as you have. As I wrote, this also works 
for properties.


HTH

Thorsten

Reply via email to