Skip to content

Instantly share code, notes, and snippets.

View jbarciauskas's full-sized avatar

Joel Barciauskas jbarciauskas

View GitHub Profile
import codecs
def unicode_safe_127(ss):
"""safely handle strings with hard ordinal values greater than 127
by escaping each value as appropriate"""
mys = ss
tos=[]
for i,s in enumerate(mys):
if ord(s)>127:
print codecs.unicode_escape_encode(mys)[0]