Personal tools
You are here: Home Members jgsack's Home PythonUnicode
Views
PythonUnicode copied.

The docs are still a bit fuzzy, but there are a couple of basic recipes
  • use codecs.open
  • use codecs.lookup, then..
  • use wrappers around pre-opened files
  • use explicit decode, encode
Things to remember
  • string means a sequence of bytes (I like to say 8-bit string)
  • unicode string is a sequence of unicode characters in Python's internal representation, which for the record may be either 16 or 32 bit.
  • everybody else probably calls this next part obvious, but I find it reassuring to be explicit:
  • encoding means translating from native to external format
  • decoding means translating from external format to native
  • encoded data is some kind of externally-meaningful binary data (in a buffer, in exernal files). It is not directly meaningful to python; it is encoded relative to Python native representation and must be decoded to get character data that python can operate on. I sometimes like to call coded data external data or foreign data.

###



Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: