Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DDD53200BA1 for ; Mon, 17 Oct 2016 14:46:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DC774160AEC; Mon, 17 Oct 2016 12:46:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2EA4C160AE5 for ; Mon, 17 Oct 2016 14:46:01 +0200 (CEST) Received: (qmail 11236 invoked by uid 500); 17 Oct 2016 12:45:59 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 10886 invoked by uid 99); 17 Oct 2016 12:45:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Oct 2016 12:45:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id D25462C4C72 for ; Mon, 17 Oct 2016 12:45:58 +0000 (UTC) Date: Mon, 17 Oct 2016 12:45:58 +0000 (UTC) From: "Ben Fortuna (JIRA)" To: dev@cocoon.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (COCOON-2352) XMLEncoder doesn't support Unicode surrogate pairs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 17 Oct 2016 12:46:02 -0000 [ https://issues.apache.org/jira/browse/COCOON-2352?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D155= 82147#comment-15582147 ]=20 Ben Fortuna edited comment on COCOON-2352 at 10/17/16 12:45 PM: ---------------------------------------------------------------- Hmm, do you have a link to the source? I checked on BRANCH_2_1_X and it sti= ll has the old code. I noticed the error is on line 42, but the test I subm= itted only has 33 lines.=20 Note it is important for the test to encode the surrogate pairs together, w= hich is why I had the sequence like this: ``` char[] expectedValue =3D encoder.encode((char) 127808); // surrogate 1/2 assertTrue(encoder.encode('\uD83C').length =3D=3D 0); // surrogate 2/2 assertTrue(Arrays.equals(expectedValue, encoder.encode('\uDF40'))); ``` was (Author: fortuna): Hmm, do you have a link to the source? I checked on BRANCH_2_1_X and it sti= ll has the old code. I noticed the error is on line 42, but the test I subm= itted only has 33 lines.=20 Note it is important for the test to encode the surrogate pairs together, w= hich is why I had the sequence like this: {code} char[] expectedValue =3D encoder.encode((char) 127808); // surrogate 1/2 assertTrue(encoder.encode('\uD83C').length =3D=3D 0); // surrogate 2/2 assertTrue(Arrays.equals(expectedValue, encoder.encode('\uDF40'))); {code} > XMLEncoder doesn't support Unicode surrogate pairs > -------------------------------------------------- > > Key: COCOON-2352 > URL: https://issues.apache.org/jira/browse/COCOON-2352 > Project: Cocoon > Issue Type: Bug > Components: * Cocoon Core, Blocks: Serializers > Affects Versions: 2.1.12 > Reporter: Ben Fortuna > Assignee: Francesco Chicchiricc=C3=B2 > Fix For: 2.1.13 > > > Whilst investigating an issue with the Sling project and support for emoj= i characters, I've come to notice that the XMLEncoder used by HTMLSerialize= r doesn't support Unicode surrogate pairs to represent higher order unicode= characters. > A simple unit test that demonstrates this issue is here: > https://github.com/micronode/whistlepost/blob/master/whistlepost-rewrite-= lib/src/test/groovy/org/apache/cocoon/components/serializers/encoding/XMLEn= coderTest.groovy > More background info here also: SLING-5973 > This seems to have been identified/addressed in other Apache projects als= o: > https://issues.apache.org/jira/browse/THRIFT-3403?jql=3Dtext%20~%20%22sur= rogate%20pairs%22 -- This message was sent by Atlassian JIRA (v6.3.4#6332)