Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Joey Adams <joeyadams3(dot)14159(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bernd Helmle <mailings(at)oopsware(dot)de>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, David Fetter <david(at)fetter(dot)org>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Initial Review: JSON contrib modul was: Re: Another swing at JSON
Date: 2011-07-20 10:49:09
Message-ID: B91ADDE3-4B8E-4E5A-BE14-D2FE39D9EF52@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul20, 2011, at 06:40 , Joey Adams wrote:
> On Wed, Jul 20, 2011 at 12:32 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>>> Thanks for the input. I'm leaning in this direction too. However, it
>>> will be a tad tricky to implement the conversions efficiently, ...
>>
>> I'm a bit confused, because I thought what I was talking about was not
>> doing any conversions in the first place.
>
> We want to be able to handle \uXXXX escapes when the database encoding
> is not UTF-8. We could leave them in place, but sooner or later
> they'll need to be converted in order to unwrap or compare JSON
> strings.

Hm, I agree that we need to handle \uXXXX escapes in JSON input.
We won't ever produce them during output though, right?

> The approach being discussed is converting escapes to the database
> encoding. This means escapes of characters not available in the
> database encoding (e.g. \u266B in ISO-8859-1) will be forbidden.
>
> The PostgreSQL parser (which also supports Unicode escapes) takes a
> simpler approach: don't allow non-ASCII escapes unless the server
> encoding is UTF-8.

Maybe JSON should simply reject them too, then. At least for now.

How does that XML type handle the situation? It seems that it'd have
the same problem with unicode entity references "&#XXXX;".

best regards,
Florian Pflug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-07-20 12:44:48 Re: sepgsql documentation fixes
Previous Message Florian Pflug 2011-07-20 10:37:48 Re: Another issue with invalid XML values