May-01-2017, 03:52 PM
The "unicode_escape" codec is your friend:
Output:>>> x=u'Dèjà-vu\n\t'
>>> codecs.encode(x,'unicode_escape')
'D\\xe8j\\xe0-vu\\n\\t'
>>> print codecs.encode(x,'unicode_escape')
D\xe8j\xe0-vu\n\t
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net