On Thursday 03 April 2008 18:40:52 Kropp, Henning wrote:
> Dear Kai,
>
> I was able to run your example with no problem at last. The reason why
Thanks for your quick answer :)

> you test fails is, as said early your sample-data.xml file is not utf-8
> encoded. To be clear, its not a matter of changing the xml directive its
> a matter of *real* file encoding.
>
I really checked that several times but obviously got it wrong all the time. I 
used 4 approaches:

1.) vim
:set fileencodings=utf8
:edit src/test/resources/sample-data.xml
-> file looked o.k.
:set fileencodings=latin1
:edit src/test/resources/sample-data.xml
-> file looked garbelded
--> so I asumed, that it was encoded right.

2.) eclipse
Default-encoding is set to UTF-8
I opened the files and everything looked right.
To be sure, I replaced all umlauts again in eclipse and doublechecked with 
vim. Everything looked right to me...

3.) nativ2ascii
native2ascii src/test/resources/sample-data.xml
showed two bytes for the 'ä'. When I encoded the file in latin1
via vim, it showd only one. So I thought, that every thing was right.

4.) od
od  -tcx src/test/resources/sample-data.xml
showd my two bytes two and the weired "À", I always thought of
as what you got, if you print an UTF-8 ä as latin1...

Obviously, all tests are wrong. Do you know an easy, bulletproofe way to check 
the encoding of files?!
How do you check such things?
Do you know any neat tool, that gueses the encoding? I cannot find anyone...

> If you encode your sample-data.xml in utf-8 with iconv
> (http://rzaix12.rrz.uni-hamburg.de/doc_link/C/a_doc_lib/cmds/aixcmds3/iconv
>.htm) your test should work just fine.
>
I tried "iconv -f latin1 -t utf8 src/test/resources/sample-data.xml > tmp" 
and "mv tmp src/test/resoures/sample-data.xml". But the testcase failes 
again :(
Also, vim and eclipse are now showing garbage ("ä"), instead of the ä!
Are you sure, that my src/test/resource/sample-data.xml is encoded in latin1?!

> Be aware that uploading, downloading files over the network might change
> the file encoding again.
I'm running all my tests on local machine. Also up-/downloading via scp 
shouldn't change anything, shouldn't it?

Regards 

Kai Moritz

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to