From: Chris <dmagick@gmail.com>
To: V S P <toreason@fastmail.fm>
Cc: pgsql-php@postgresql.org
Subject: Re: [Q] storing JSON, problem with 'escapes'
Date: Fri, 21 Nov 2008 18:17:59 +1100
Message-ID: <492660A7.3060008@gmail.com> (raw)
In-Reply-To: <1227250475.15555.1285991741@webmail.messagingengine.com>
References: <1227250475.15555.1285991741@webmail.messagingengine.com>
V S P wrote:
> Hi,
> I am using PHP's json_encode function on
> an array of strings
> that gives me back a JSON encoded string.
>
> Some of the elements in the string arrays have
> double quotes. So PHP's json_encode correctly
> escapes them (according to JSON specifications)
> with \.
>
> For example here is a an array element
>
> "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK("b2122") ;}"
>
> would get encoded in JSON as
>
> "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK(\"b2122\") ;}"
Is magic_quotes_gpc (or magic_quotes_runtime) on for the php server?
Check with a phpinfo() page.
If so, you'll need to "undo" that, see http://www.php.net/stripslashes
(inc. the recursive function stripslashes_deep).
--
Postgresql & php tutorials
http://www.designmagick.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: dmagick@gmail.com, toreason@fastmail.fm
Subject: Re: [Q] storing JSON, problem with 'escapes'
In-Reply-To: <492660A7.3060008@gmail.com>
References: <1227250475.15555.1285991741@webmail.messagingengine.com> <492660A7.3060008@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox