Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 73080 invoked from network); 12 Oct 2005 13:58:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Oct 2005 13:58:49 -0000 Received: (qmail 47660 invoked by uid 500); 12 Oct 2005 13:58:35 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 47596 invoked by uid 500); 12 Oct 2005 13:58:35 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 47574 invoked by uid 99); 12 Oct 2005 13:58:35 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Oct 2005 06:58:32 -0700 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 4079951B for ; Wed, 12 Oct 2005 15:58:11 +0200 (CEST) Message-ID: <2135417684.1129125491261.JavaMail.jira@ajax.apache.org> Date: Wed, 12 Oct 2005 15:58:11 +0200 (CEST) From: "Emmanuel Lecharny (JIRA)" To: dev@directory.apache.org Subject: [jira] Assigned: (DIRSNICKERS-112) DERUTF8String does not read and write UTF-8 In-Reply-To: <1541266347.1129124645816.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DIRSNICKERS-112?page=3Dall ] Emmanuel Lecharny reassigned DIRSNICKERS-112: --------------------------------------------- Assign To: Emmanuel Lecharny (was: Alex Karasulu) > 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 '=C3=B6' (U+00F6 Latin Small Letter O With Diaeresi= s) which should be serialized to 0xC3B6 seems to be serialized to 0xF6. DER= UTF8String uses only one byte for each char. This means only ASCII characte= rs 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 =3D string.toCharArray(); > byte[] bytes =3D new byte[ characters.length ]; > for ( int ii =3D 0; ii < characters.length; ii++ ) > { > bytes[ ii ] =3D (byte)characters[ ii ]; > } > return bytes; > } > This method converts parameter first to char array. Chars are UTF-16 and = cannot be casted to byte directly. =20 > Conversion should be done using method getBytes with parameter "UTF-8" of= class String.=20 --=20 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