Swedish characters in Python strings

Bengt Richter bokr at oz.net
Tue Oct 15 16:09:55 EDT 2002


On Sun, 13 Oct 2002 15:39:50 +0200, Magnus Heino <magnus.heino at pleon.sigma.se> wrote:
>Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
>[GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>>>> import MP3Info
>>>> title = getattr(MP3Info.MP3Info(open('file.mp3', 'rb')), 'title')
>>>> title
>'K\xf6ttbullar i n\xe4san'
>>>> print title
>K?ttbullar i n?san
>>>> type(title)
><type 'str'>
>>>> print title
>K?ttbullar i n?san
>>>> print u'K\xf6ttbullar i n\xe4san'.encode('utf-8')
>Köttbullar i näsan
>>>>
[OT] LOL! Is that a real title ?

Regards,
Bengt Richter



More information about the Python-list mailing list