"Steven D'Aprano" <steve+comp.lang.pyt...@pearwood.info> wrote:

If myVar is a Unicode string, you don't need to care about the encoding (UTF-8 or otherwise) until you're ready to write it to a file. Then I strongly recommend you always use UTF-8, unless you have to interoperate with some old, legacy system:

assert isinstance(myVar, unicode)
byte_string = myVar.encode('utf-8')

An excellent summary of the mystics around text-encoding. Thank you.

--gv
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to