This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import jsonpickle | |
>>> import simplejson.encoder | |
>>> t = '<script src="http://www.google.com/auth.js"></script>' | |
>>> jsonpickle.encode(t, unpicklable=True) | |
'"<script src=\\"http://www.google.com/auth.js\\"></script>"' | |
>>> jsonpickle.set_encoder_options('simplejson', cls=simplejson.encoder.JSONEncoderForHTML) | |
>>> jsonpickle.encode(t, unpicklable=True) | |
'"\\u003cscript src=\\"http://www.google.com/auth.js\\"\\u003e\\u003c/script\\u003e"' | |
>>> import datetime | |
>>> d = {'html': t, 'date': datetime.datetime.now()} |
NewerOlder