- Original Message -
From: Matt guitarroman...@gmail.com
To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Friday, June 05, 2009 10:05 AM
Subject: [Proto-Scripty] Re: HTML breaks JSON
Hi Alex,
Still didn't work for me :( Just produced broken HTML output again
Sorry, here's a clearer listing:
http://us3.php.net/manual/en/language.types.intro.php
Walter
On Jun 8, 2009, at 11:05 AM, Walter Lee Davis wrote:
That means it can be an Array, an Object, a String, an Integer, a
Boolean, a Floating Point Number or NULL, according to this list of
Types:
2009/6/8 Walter Lee Davis wa...@wdstudio.com:
Sorry, here's a clearer listing:
http://us3.php.net/manual/en/language.types.intro.php
Walter
On Jun 8, 2009, at 11:05 AM, Walter Lee Davis wrote:
That means it can be an Array, an Object, a String, an Integer, a
Boolean, a Floating Point
...@leedsguide.co.uk
To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, June 04, 2009 4:30 PM
Subject: [Proto-Scripty] Re: HTML breaks JSON
Hi again,
I've been running addslashes() on the input before running json_encode
() and it still creates problems
Matt wrote:
Hi Alex,
Still didn't work for me :( Just produced broken HTML output again.
If your html code is not broken on inside of php variable, then it
won't break anything inside json_encode;
[code]
?php
$html = '
div id=someIdthis is correct html
span
very strange .. works for me with anything all the time
- Original Message -
From: Matt guitarroman...@gmail.com
To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Friday, June 05, 2009 10:05 AM
Subject: [Proto-Scripty] Re: HTML breaks JSON
Hi Alex,
Still
Hi again,
I've been running addslashes() on the input before running json_encode
() and it still creates problems when I pass it through AJAX - breaks
HTML tags etc. If I turn addslashes() off, any occurence of in the
body text (eg quotes from speakers etc) breaks the code again. Does
anyone
will with it after this
unless you know the key names !!
This should do the trick for you
HTH
ALex
- Original Message -
From: Matt i...@leedsguide.co.uk
To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, June 04, 2009 4:30 PM
Subject: [Proto-Scripty] Re
@Ananth:
Converting to Base64 would be massive overkill, surely.
@OP:
There's no reason you can't include strings containing HTML in JSON
data. You just have to make sure your strings are valid string
literals, like this:
{
message: pThis is HTML./p
}
There's nothing special other than
JSON should not contain HTML for tactical/ease of programming purposes
unless the HTML is there as part of a larger design, but there may or may
not be implementation restrictions.
If you are facing problems, can you try encoding the HTML string (Base64)
and decoding back (using Javascript Base64
What are you sending to PHP's json_encode? It is expecting a
structure to serialize into a JSON syntax string.
$struct = array(message = h1Hello World/h1Who says we can't
have any kind of \quotes\ we want?);
echo json_encode($struct);
If you try to run json_encode on your already JSONified
11 matches
Mail list logo