You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Henning P. Schmiedehausen" <hp...@intermeta.de> on 2005/09/02 10:05:48 UTC

Re: [jira] Commented: (MPXDOC-154) system locale setting makes test

Lukas Theussl <th...@triumf.ca> writes:

>    String expect = "Fran�ais";

IMHO you are barking at the wrong tree.

As long as you have non-US-ASCII characters in the Java source code,
all bets are off. The compiler interprets the contents of the source
file according to its own language preferences. man javac(1), look for
"-encoding".

Just work around this by adding

maven.compile.encoding = ISO-8859-1

to the project.properties. Trying to second guess the platform
encoding will lead you nowhere.

Without this line, the tests still fail. Using UTF-8 locale, Java tries
to interpret the c-cedille as Unicode and the match fails.

You will still put a "gotcha" in. If someone opens the source code
file with an unicode based editor, the character will be unreadable
and if he changes it to a correct UTF-8 c-cedille (can you spell
emacs?), then the tests will fail _again_. So replace the c-cedille
with a \xxx sequence. Can't tell you the right value from the top of
my head, though.

This is what we got for not making UTF-8 compatible to ISO-8859-1. 

	Regards
		Henning

>    String result = LocaleUtil.displayName(locale, locale);
>    try { // Convert from Unicode to UTF-8
>        String string = "Fran\u00e7ais";
>        byte[] utf8 = string.getBytes("UTF-8");
>        expect = new String(utf8, "UTF-8");
>    } catch (UnsupportedEncodingException e) {
>    }
>    assertEquals(result, expect);
>  }

>Can you guys confirm that this still works for you?

>- Lukas

>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org