Tino Schwarze a écrit :

On Fri, Dec 29, 2006 at 08:37:07PM +0100, Emmanuel Lecharny wrote:

There is a _big_ difference, because your java file might have been saved using a ISO-8859-1 encoding. new RDN( "ä" ) just use the default encoding of your computer to store the file, and inside this file you

I was not talking about characters from a Java source, the data came
directly from a database. The test case is pretty simple:

   byte[] _bytes = new byte[] { (byte)0xc3, (byte)0xa4, (byte)0xc3, (byte)0xb6, 
(byte)0xc3, (byte)0xbc };
String _s = new String (_bytes, "utf-8"); // this should print äöü
   System.out.println (_s);
   LdapDN _dnTest = new LdapDN();
   _dnTest.add ("cn=Uml"+_s);
   System.out.println (_dnTest.toString());
-> this will get mixed up instantly by the RdnParser - it converts every
non-ASCII byte to \xy encoding (I'm not sure who's doing the "\" to "%5C"
conversion later).
Ok, I get it now. First, apologize to have so badly name this method ... toString() is such a pathetic name when it does not give you back what you are expecting... Just try this :

System.out.println ( _dnTest.getUpName() );

you will have your expected result. The toString() method is supposed (well, 
whip me, it's terribly bad), to return a String for debug usage. The worst 
thing is that this method is _never_ used anywhere in the server, except in 
unit tests ;(

Ok, I promise I will fix that : switching the semantic of toString() to it's 
correct value.

Emmanuel

Bye,

Tino.


Reply via email to