Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 27966 invoked from network); 8 Jun 2009 14:29:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Jun 2009 14:29:02 -0000 Received: (qmail 48595 invoked by uid 500); 8 Jun 2009 14:29:14 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 48549 invoked by uid 500); 8 Jun 2009 14:29:14 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 48540 invoked by uid 99); 8 Jun 2009 14:29:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jun 2009 14:29:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jun 2009 14:29:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F21CD238888D; Mon, 8 Jun 2009 14:28:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r782645 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb src/mochiweb/mochijson2.erl Date: Mon, 08 Jun 2009 14:28:49 -0000 To: commits@couchdb.apache.org From: kocolosk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090608142849.F21CD238888D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kocolosk Date: Mon Jun 8 14:28:49 2009 New Revision: 782645 URL: http://svn.apache.org/viewvc?rev=782645&view=rev Log: merged r782643 (accept UTF-16 surrogate pairs) Modified: couchdb/branches/0.9.x/ (props changed) couchdb/branches/0.9.x/etc/default/couchdb (props changed) couchdb/branches/0.9.x/src/mochiweb/mochijson2.erl Propchange: couchdb/branches/0.9.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Jun 8 14:28:49 2009 @@ -1,3 +1,3 @@ /couchdb/branches/design_resources:751716-751803 /couchdb/branches/form:729440-730015 -/couchdb/trunk:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765364,765419-765420,765479,765819,766338,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,771474,771480,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181,774587,775507,775577,775634,775724,775796,776143,776685,778949,780197,780318,780326,780328,780338,780348,780350 +/couchdb/trunk:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765364,765419-765420,765479,765819,766338,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,771474,771480,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181,774587,775507,775577,775634,775724,775796,776143,776685,778949,780197,780318,780326,780328,780338,780348,780350,782643 Propchange: couchdb/branches/0.9.x/etc/default/couchdb ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Jun 8 14:28:49 2009 @@ -1,4 +1,4 @@ /couchdb/branches/design_resources/etc/default/couchdb:751716-751803 /couchdb/branches/form/etc/default/couchdb:729440-730015 -/couchdb/trunk/etc/default/couchdb:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765364,765419-765420,765479,765819,766338,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,771474,771480,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181,774587,775507,775577,775634,775724,775796,776143,776685,778949,780197,780318,780326,780328,780338,780348,780350 +/couchdb/trunk/etc/default/couchdb:758717,758723,758768,758942,759588,760442,760503,760532-760533,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,762019,762153,762574,763816,763818,763833,764257,764835,765364,765419-765420,765479,765819,766338,766340,766347,766353,766358,766373,766383,766390,766392,766399,766406-766407,766456,766467,766476,766493,766505-766506,766751,766767,767164,767175-767176,767190,767204,767206,767208,767362,767398,767506,767543,768573,769109,769127,769181,769211,769792,769804,770782,771418,771466-771467,771472,771474,771480,772406,772415,772978,773225,773260,773319,773387,773401,774045,774095,774101,774180-774181,774587,775507,775577,775634,775724,775796,776143,776685,778949,780197,780318,780326,780328,780338,780348,780350,782643 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.9.x/src/mochiweb/mochijson2.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/mochiweb/mochijson2.erl?rev=782645&r1=782644&r2=782645&view=diff ============================================================================== --- couchdb/branches/0.9.x/src/mochiweb/mochijson2.erl (original) +++ couchdb/branches/0.9.x/src/mochiweb/mochijson2.erl Mon Jun 8 14:28:49 2009 @@ -371,11 +371,20 @@ tokenize_string(B, ?ADV_COL(S, 2), [$\r | Acc]); <<_:O/binary, "\\t", _/binary>> -> tokenize_string(B, ?ADV_COL(S, 2), [$\t | Acc]); - <<_:O/binary, "\\u", C3, C2, C1, C0, _/binary>> -> - %% coalesce UTF-16 surrogate pair? + <<_:O/binary, "\\u", C3, C2, C1, C0, Rest/binary>> -> C = erlang:list_to_integer([C3, C2, C1, C0], 16), - Acc1 = lists:reverse(xmerl_ucs:to_utf8(C), Acc), - tokenize_string(B, ?ADV_COL(S, 6), Acc1); + if C > 16#D7FF, C < 16#DC00 -> + %% coalesce UTF-16 surrogate pair + <<"\\u", D3, D2, D1, D0, _/binary>> = Rest, + D = erlang:list_to_integer([D3,D2,D1,D0], 16), + [CodePoint] = xmerl_ucs:from_utf16be(<>), + Acc1 = lists:reverse(xmerl_ucs:to_utf8(CodePoint), Acc), + tokenize_string(B, ?ADV_COL(S, 12), Acc1); + true -> + Acc1 = lists:reverse(xmerl_ucs:to_utf8(C), Acc), + tokenize_string(B, ?ADV_COL(S, 6), Acc1) + end; <<_:O/binary, C, _/binary>> -> tokenize_string(B, ?INC_CHAR(S, C), [C | Acc]) end. @@ -541,6 +550,7 @@ test_all() -> [1199344435545.0, 1] = decode(<<"[1199344435545.0,1]">>), + <<16#F0,16#9D,16#9C,16#95>> = decode([34,"\\ud835","\\udf15",34]), test_one(e2j_test_vec(utf8), 1). test_one([], _N) ->