New Note 43 Another reason which I ran across just now is that some software packages refuse to outputting escaped characters. Case in point: I'm trying to use Python to generate a JSON (ie, Javascript-syntax) array which contains a transliteration scheme called Velthuis. The scheme holds rules like this: AA Ā The library I used (because it was sitting around, maybe there's something better now) is called simplejson. Here's what happened:

>>> v = {} # velthuis transliteration dictionary
>>> v[u'AA'] = u'Ā'  # putting a single pair to test
>>> print v.items() 
[(u'AA', u'\u0100')]
>>> # Python wants to send an escape to the terminal, and... 
>>> print simplejson.dumps( v.items())
[["AA", "\u0100"]]
>>> # So does simplejson's "dump string" function dumps(). What happens if if we use dump() instead, which will write to a file, which we can specify as utf-8 encoded?
>>> import codecs
>>> utf8_filepointer = codecs.open('doesitescape.log', mode='w', encoding='utf-8')
>>> simplejson.dump(v.items(), utf8_filepointer)
>>> # Okay, that worked...


[1]+  Stopped                 python
pat@gobaith:~/Desktop/tipitaka/velthuis$ cat doesitescape.log 
[["AA", "\u0100"]]