quick unicode Q

Erik Max Francis max at alcyone.com
Wed Dec 14 19:23:28 EST 2005


John Morey wrote:

> I have a variable that contains a string which may or may not include 
> unicode characters, I understand that I declare a unicode string like this
> u'whatever' , the question is that when that string is read in from
> an external source (in this case an id3 tag) how do I make the
> interpretter understand that it may contain unicode?

Read it as a string, and then decode it with the .decode method.  You 
specify what encoding it's in.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   You are in the music / In the man's car next to me
   -- Sade



More information about the Python-list mailing list