Skip to content

Instantly share code, notes, and snippets.

View sente's full-sized avatar

Stuart Powers sente

View GitHub Profile
import codecs
def unicode_safe_127(ss, debug=False):
"""safely handle strings with have ordinal values greater than 127
by escaping each value as appropriate.
if debug=True, log each conversion to stderr
"""
mys = ss
tos=[]
for i,s in enumerate(mys):