Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6374663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:30:59+00:00 2026-05-25T01:30:59+00:00

I’ve run into a problem when reading some id3 tags with Icelandic letters. A

  • 0

I’ve run into a problem when reading some id3 tags with Icelandic letters.
A quick example from the shell.

>>> audio = mutagen.easyid3.EasyID3('./Björk/Albums/1990 - Gling-Gló [mp3-231]/01 - Gling-Gló.mp3')
>>> audio['title']
5: [u'Gling-Gl\xf3']

First of all, I’m not really sure how to check which character encoding the tags are in. From what I’ve gathered, this is the way to do it with mutagen:

>>> audio = mutagen.id3.ID3('./Björk/Albums/1990 - Gling-Gló [mp3-231]/01 - Gling-Gló.mp3')
>>> for key, value in audio.items():
...     print value.encoding

This outputs ‘0’ for each item.

And I saw somewhere that for id3 tags, the number 0 meant the string is iso-8859-1 encoded, but I don’t know where to go from there. I guess this isn’t right?

>>> audio.get('artist')[0].decode('iso-8859-1')
14: u'Bj\xc3\xb6rk'

As you can propably tell I am seriously confuses when it comes to character encoding issues.
All I want is to capture the tags as proper utf-8 strings so I can put them in my database.
This is just one example though, I guess I’ll probably run into some other files with completely different encodings so I’m looking for a good all around solution. Just fixing this would really help me get on the track though.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:30:59+00:00Added an answer on May 25, 2026 at 1:30 am

    Welcome to the fun world of encoding.

    In this step:

    >>> audio = mutagen.easyid3.EasyID3('./Björk/Albums/1990 - Gling-Gló [mp3-231]/01 - Gling-Gló.mp3')
    >>> audio['title']
    [u'Gling-Gl\xf3']
    

    …you end up with a unicode byte string. In the second line, Python is printing out an ASCII represntation of this byte string, which is why you see the hex values. What you need is for Python to take that byte string and encode it using one of the available character encodings. This was a source of confusion for me too. Just remember, you decode from the characters into the hex values and you encode the hex values into characters.

    So, if you do this:

    In [1]: s = u'./Björk/Albums/1990 - Gling-Gló [mp3-231]/01 - Gling-Gló.mp3'
    
    In [2]: s
    Out[2]: u'./Bj\xf6rk/Albums/1990 - Gling-Gl\xf3 [mp3-231]/01 - Gling-Gl\xf3.mp3'
    
    In [3]: s.encode('UTF-8')
    Out[3]: './Bj\xc3\xb6rk/Albums/1990 - Gling-Gl\xc3\xb3 [mp3-231]/01 - Gling-Gl\xc3\xb3.mp3'
    

    Well, that’s annoying. You told it to encode in UTF-8 but you still got ASCII. The trick is that doing such a call in Python just outputs the ASCII representation of whatever the input was. If you change it to:

    In [4]: print s.encode('UTF-8')
    ./Björk/Albums/1990 - Gling-Gló [mp3-231]/01 - Gling-Gló.mp3
    

    …you see the correct result. So, once you actually do something with the newly encoded text, you’ll see it represented the way you want. Printing it to the console, writing it to a file, or displaying it in a GUI widget should look fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.