Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 73943 invoked from network); 10 Oct 2005 20:53:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Oct 2005 20:53:34 -0000 Received: (qmail 69526 invoked by uid 500); 10 Oct 2005 20:53:33 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 69468 invoked by uid 500); 10 Oct 2005 20:53:33 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 69457 invoked by uid 99); 10 Oct 2005 20:53:33 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Oct 2005 13:53:33 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 10 Oct 2005 13:53:35 -0700 Received: (qmail 73796 invoked by uid 65534); 10 Oct 2005 20:53:12 -0000 Message-ID: <20051010205312.73753.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r312737 - /directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java Date: Mon, 10 Oct 2005 20:53:11 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: elecharny Date: Mon Oct 10 13:53:06 2005 New Revision: 312737 URL: http://svn.apache.org/viewcvs?rev=312737&view=rev Log: Fixed the umlaut test : String should not contains non ASCII characters if they are saved using ISO-8858-1 local (typically under windows computers here in Europe), or if using Eclipse, files encoding *must* be set to UTF-8 encoding. However, using a byte[] seems to be a bulletproof solution here ;) Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java Modified: directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java URL: http://svn.apache.org/viewcvs/directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java?rev=312737&r1=312736&r2=312737&view=diff ============================================================================== --- directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java (original) +++ directory/testsuite/trunk/ldaptests/src/main/java/org/apache/ldap/testsuite/ldaptests/jndi/ops/add/SpecialCharacterAddTests.java Mon Oct 10 13:53:06 2005 @@ -16,6 +16,8 @@ */ package org.apache.ldap.testsuite.ldaptests.jndi.ops.add; +import java.io.UnsupportedEncodingException; + import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; @@ -51,14 +53,15 @@ super.tearDown(); } - public void testAddEntryWithGermanUmlauts() throws NamingException + public void testAddEntryWithGermanUmlauts() throws NamingException, UnsupportedEncodingException { - // Create a person with german "umlaut" - String cnValue = "Stefan Zörner"; - String snValue = "Zörner"; + // Create a person with german "umlaut". The UTF-8 bytes code for + // a german o umlaut is C3 B6. Its equivalence in ISO-8859-1 is F6. + String cnValue = new String(new byte[]{'S', 't', 'e', 'f', 'a', 'n', ' ', 'Z', (byte)0xC3, (byte)0xB6, 'r', 'n', 'e', 'r'}, "UTF-8"); + String snValue = new String(new byte[]{'Z', (byte)0xC3, (byte)0xB6, 'r', 'n', 'e', 'r'}, "UTF-8"); String rdn = "cn=" + cnValue; - String allUmlauts = "äöüÄÖÜß"; + String allUmlauts = new String(new byte[]{(byte)0xC3, (byte)0xB6, (byte)0xC3, (byte)0xB6, (byte)0xC3, (byte)0xB6, (byte)0xC3, (byte)0xB6, (byte)0xC3, (byte)0xB6, (byte)0xC3, (byte)0xB6, (byte)0xC3, (byte)0xB6,}, "UTF-8"); Attributes attributes = AttributesFactory.createPersonAttributes(cnValue, snValue); attributes.put("description", allUmlauts);