Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 34569 invoked from network); 27 Feb 2006 14:04:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Feb 2006 14:04:42 -0000 Received: (qmail 90212 invoked by uid 500); 27 Feb 2006 14:04:21 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 90151 invoked by uid 500); 27 Feb 2006 14:04:21 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 90139 invoked by uid 99); 27 Feb 2006 14:04:21 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2006 06:04:21 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=RCVD_IN_SORBS_WEB,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 217.158.94.220 is neither permitted nor denied by domain of t.p.ellison@gmail.com) Received: from [217.158.94.220] (HELO cirrus.purplecloud.com) (217.158.94.220) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2006 06:04:20 -0800 Received: (qmail 12351 invoked from network); 27 Feb 2006 14:03:58 +0000 Received: from blueice2n1.uk.ibm.com (HELO ?9.20.183.163?) (195.212.29.75) by smtp.purplecloud.net with (DHE-RSA-AES256-SHA encrypted) SMTP; 27 Feb 2006 14:03:58 +0000 Message-ID: <440306CE.4000606@gmail.com> Date: Mon, 27 Feb 2006 14:03:58 +0000 From: Tim Ellison User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: [jira] Commented: (HARMONY-137) CharsetDecoder should replace undefined bytes with replacement string References: <2072939177.1141029896480.JavaMail.jira@ajax.apache.org> In-Reply-To: <2072939177.1141029896480.JavaMail.jira@ajax.apache.org> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Paulex, Please add the ICU bug number to this JIRA when you have it -- thanks. Regards, Tim Paulex Yang (JIRA) wrote: > [ http://issues.apache.org/jira/browse/HARMONY-137?page=comments#action_12367917 ] > > Paulex Yang commented on HARMONY-137: > ------------------------------------- > > A little investigation on the Harmony codes, seems it is caused by problems of ICU4JNI decoder provider, the following test cases shows that. RI "cp1250" passes the testcase while ICU "cp1250" fails under either RI or Harmony . I'll try to report the bug to ICU. > > Test case: > > public void testDecode_JIRA137() { > ByteBuffer bb = ByteBuffer.allocate(5); > bb.put((byte) 0x81); > bb.flip(); > // Use ICU cp1250 charset > CharsetProviderICU provider = new CharsetProviderICU(); > Charset cp1250 = provider.charsetForName("cp1250"); > // Uncomment code below to use RI charset > //cp1250 = Charset.forName("cp1250"); > CharBuffer cb; > try { > cb = cp1250.newDecoder() > .onMalformedInput(CodingErrorAction.REPLACE) > .onUnmappableCharacter(CodingErrorAction.REPLACE) > .decode(bb); > assertEquals(0XFFFD,cb.get(0)); > } catch (CharacterCodingException e) { > e.printStackTrace(); > } > } > >> CharsetDecoder should replace undefined bytes with replacement string >> --------------------------------------------------------------------- >> >> Key: HARMONY-137 >> URL: http://issues.apache.org/jira/browse/HARMONY-137 >> Project: Harmony >> Type: Bug >> Components: Classlib >> Reporter: Vladimir Strigun >> Priority: Minor > >> Corresponding to cp1250 mapping table, 0x81 byte is undefined. See http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT >> So, charset decoder should replace undefined bytes with default replacement, i.e. 0xFFFD. >> Testcase for reproducing this issue: >> import java.nio.charset.*; >> import java.nio.*; >> public class Harmony137 { >> public static void main(String[] args) throws Exception { >> ByteBuffer bb = ByteBuffer.allocate(5); >> bb.put((byte)0x81); bb.flip(); >> Charset cp1250 = Charset.forName("cp1250"); >> CharBuffer cb = cp1250.newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE).decode(bb); >> if(cb.get(0)!=65533) { >> System.out.println("FAIL: expected 0xFFFD but result is: 0x"+Integer.toHexString(cb.get(0)).toUpperCase()); >> } >> } >> } > -- Tim Ellison (t.p.ellison@gmail.com) IBM Java technology centre, UK.