You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <di...@incubator.apache.org> on 2005/10/12 23:32:05 UTC

[jira] Resolved: (DIRSNICKERS-112) DERUTF8String does not read and write UTF-8

     [ http://issues.apache.org/jira/browse/DIRSNICKERS-112?page=all ]
     
Emmanuel Lecharny resolved DIRSNICKERS-112:
-------------------------------------------

    Resolution: Fixed

The class DEFString has been fixed to handle UTF-8 strings. 

I'm not sure that this is enough, because it supposes that *all* strings are UTF-8 encoded, which is not something we can say. It depends on the grammar using this DERString, but I bet it's enough for Kerberos.

> DERUTF8String does not read and write UTF-8
> -------------------------------------------
>
>          Key: DIRSNICKERS-112
>          URL: http://issues.apache.org/jira/browse/DIRSNICKERS-112
>      Project: Directory ASN1
>         Type: Bug
>   Components: BER Runtime
>     Versions: 0.3.0
>     Reporter: Tomi Keinonen
>     Assignee: Emmanuel Lecharny

>
> DERUTF8String class does not serialize Strings to byte arrays correctly. Also byte arrays seem to be deserialized to Strings incorrectly.
> For example character 'รถ' (U+00F6 Latin Small Letter O With Diaeresis) which should be serialized to 0xC3B6 seems to be serialized to 0xF6. DERUTF8String uses only one byte for each char. This means only ASCII characters work correctly. Each character which requires more than one byte causes invalid byte output.
> Class DERUTF8String seems to use incorrectly class DERString:
>     protected static byte[] stringToByteArray( String string )
>     {
>         char[] characters = string.toCharArray();
>         byte[] bytes = new byte[ characters.length ];
>         for ( int ii = 0; ii < characters.length; ii++ )
>         {
>             bytes[ ii ] = (byte)characters[ ii ];
>         }
>         return bytes;
>     }
> This method converts parameter first to char array. Chars are UTF-16 and cannot be casted to byte directly.  
> Conversion should be done using method getBytes with parameter "UTF-8" of class String. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira