Python parsing iTunes XML/COM

Jerry Hill malaclypse2 at gmail.com
Wed Jul 30 23:01:39 CEST 2008


On Wed, Jul 30, 2008 at 2:27 PM, william tanksley <wtanksleyjr at gmail.com> wrote:
> Awesome... Thank you! I had my mental model of Python turned around
> backwards. That's an odd feeling. Okay, so you decode to go from raw
> byes into a given encoding, and you encode to go from a given encoding
> to raw bytes. Not what I thought it was, but that's cool, makes sense.

That's not quite right.  Decoding takes a byte string that is already
in a particular encoding and transforms it to unicode.  Unicode isn't
a encoding of it's own.  Decoding takes a unicode string (which
doesn't have any encoding associated with it), and gives you back a
sequence of bytes in a particular encoding.

This article isn't specific to Python, but it provides a good overview
of unicode and character encodings that may be useful:
http://www.joelonsoftware.com/articles/Unicode.html

-- 
Jerry



More information about the Python-list mailing list