开发者

Ant JUnit failure with french thousands separator

Using Netbeans 6.9.1 my unit tests pass without issue. Using junit (4.8.2, which seems to be the same version that Netbeans uses) the tests fail on the command line.

The failure has to do with this line:

assertEquals("x doit être >= 10 et < 100, était la suivante: 1 000", messages_fr.between("x", 10, 100, 1000));

On the command line the message displays as:

x doit ├¬tre >= 10 et < 100, ├⌐tait la suivante: 1á000

I am at a loss for what is going on. I know that the thousands separator is not a space but 0XA0, no issue with that, but the fact that Netbeans and the command line are in disagreement about it is a real issue.

I am using ant 1.8.1 which is also the same versio开发者_Python百科n as Netbeans. It happens on OS X (10.6.5) and Windows 7. I still need to check Ubuntu 10.10.

Any ideas why it works in Netbeans but not on the command line in ant?


Note the inconsistency in the output: ê and é look like UTF-8 displayed as CP437, whereas no-break space looks like Windows-1252 displayed as CP437.

Let's put aside the fact that the console encoding (CP437) doesn't match the system encoding (Windows-1252). Then I assume that no-break space is represented properly, since it comes from the runtime library. This means that UTF-8 in representation of the message is an error. Perhaps template of your message is stored in UTF-8, but loaded as Windows-1252. If this template is stored in the code, you need to set compiler encoding to UTF-8.


I think you problem is the encoding. You can try to change the encoding of your Java class (from ISO to UTF or viceversa).

If this doesn't work, you can try to configure Ant to use the same encoding Netbeans does.

If this doesn't work too, you can try to write a method that convert your message in another message without special characters.

In Spain we have the same problems, and many times we write every string with no special character (not the best solution, but it works).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜