json_safe() ValueError for unpaired unicode surrogates

Fixed a bug in which json_safe() would raise a ValueError
when passed unpaired unicode surrogates on Linux.

I think this is the same issue reported here: http://bugs.python.org/issue11489
and also here: https://github.com/simplejson/simplejson/issues/62#issuecomment-13996448