On 4 December 2011 10:22, Peter Otten <__pete...@web.de> wrote: > I found another one: > >>>> u"äöü ΦΧΨ".encode("latin1", "backslashreplace") > '\xe4\xf6\xfc \\u03a6\\u03a7\\u03a8'
That's it! I was hoping for a built-in solution and this is it. FTR, the 'backslashreplace' argument tells the encoder to replace any character that it can't encode with a backslash escape sequence. Which is exactly what I needed, only I hadn't realised it. Thanks! -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list