Re: quick unicode Q

2005-12-15 Thread Damjan
>> Read it as a string, and then decode it with the .decode method. You >> specify what encoding it's in. > > Most probably, the OP is asking what to do with an UTF-8 encoded string. > > To decode that, just use: > > s.decode("utf-8") I prefer: unicode(s, 'utf-8') That way it's more clear that

Re: quick unicode Q

2005-12-14 Thread Heiko Wundram
Erik Max Francis wrote: > Flags in the ID3 tag specify the encoding. It is not always UTF-8. > > http://www.id3.org/id3v2.4.0-structure.txt Okay... Didn't know that, and I'm pretty sure with ID3V1 this was always utf-8 in case it was unicode (which was a non-standard extension anyway). Thanks fo

Re: quick unicode Q

2005-12-14 Thread Erik Max Francis
Heiko Wundram wrote: > Most probably, the OP is asking what to do with an UTF-8 encoded string. > > To decode that, just use: > > s.decode("utf-8") > > to get a unicode string object. Flags in the ID3 tag specify the encoding. It is not always UTF-8. http://www.id3.org/id3v2.4.0-stru

Re: quick unicode Q

2005-12-14 Thread Heiko Wundram
Erik Max Francis wrote: > Read it as a string, and then decode it with the .decode method. You > specify what encoding it's in. Most probably, the OP is asking what to do with an UTF-8 encoded string. To decode that, just use: s.decode("utf-8") to get a unicode string object. Example: >>> s

Re: quick unicode Q

2005-12-14 Thread Erik Max Francis
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