[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Unicode/UTF-8 confusion

Carsten Haese

3/15/2008 7:03:00 PM

On Sat, 2008-03-15 at 12:09 -0400, Tom Stambaugh wrote:
> [...]
> I use simplejson to serialize html strings that the server is delivering to
> a browser. Since the apostrophe is a string terminator in javascript, I need
> to escape any apostrophe embedded in the html.
> [...]

simplejson escapes them for you:

>>> import simplejson
>>> s = " ' "
>>> simplejson.dumps(s)
'" \' "'

Why is this not good enough for your needs?

--
Carsten Haese
http://informixdb.sourc...