|
Unterminated string literal error March 20, 2012 03:50PM |
Registered: 1 year ago Posts: 1 |
I am a happy HTMLPurifier for quite some time now but the last couple of days I've been puzzling why the following pasted text after being cleaned by HTMLpurifier breaks and causes a Javascript 'unterminated string literal' error on return from mySQL.
Dirty code
<span> Some text here. 
 </span>
Cleaned
<span> Some text here. ? </span>
Although it looks cleaned and the pipeline is completely UTF-8 for some reason it seems the silent killer 
 / u2028 (Line Separator) is still there even though I don't see it. If I would output it in a page everything looks normal but when using it in Javascript it will fail.
Does anyone have a suggestion on what I should do? Trying to Preg_replace it with PHP before giving it to HTMLPurifier or is there a $config I don't know about?
|
Re: Unterminated string literal error March 21, 2012 02:08PM |
Admin Registered: 6 years ago Posts: 2,636 |
http://timelessrepo.com/json-isnt-a-javascript-subset
So maybe regex and replace with the escape codes?
|
Re: Unterminated string literal error March 21, 2012 02:09PM |
Admin Registered: 6 years ago Posts: 2,636 |