nicfit / eyeD3

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
http://eyed3.nicfit.net/
GNU General Public License v3.0
532 stars 58 forks source link

Intermittent odd behavior with UTF-8 #563

Closed WGroleau closed 2 years ago

WGroleau commented 2 years ago

macOS 12.1 (21C52) with Music 1.2.1 eyeD3 0.9.6 True Blue iPadOS 15.2.1

Don't know whether this is a bug in eyeD3 or Apple's code or both…

After replacing lyrics in MP3 files, non-ASCII characters title and album (which should not have changed) are trashed in files es, el, and pt; and lyrics are trashed in files it and es

Details:

I use text and audio to help me learn a language.  I have text of a bible chapter in six languages, with two versions in English, and audio for all.  All seven MP3s are in Music.app.  All (except) one of the English, I also copied out to this directory:

WGroleau@MBP 005 % file *
59_jas_005_HTB-nl.txt: Unicode text, UTF-8 text, with very long lines (857)
59_jas_005_ICL-it.txt: Unicode text, UTF-8 text, with very long lines (883)
59_jas_005_NIV-en.txt: Unicode text, UTF-8 text, with very long lines (657)
59_jas_005_NLT-en.txt: Unicode text, UTF-8 text, with very long lines (563)
59_jas_005_NVI-es.txt: Unicode text, UTF-8 text, with very long lines (766)
59_jas_005_OL-pt.txt:  Unicode text, UTF-8 text, with very long lines (769)
59_jas_005_TGV-el.txt: Unicode text, UTF-8 text, with very long lines (802)
Sample.mp3:            Audio file with ID3 version 2.3.0
el-59_jas-005.mp3:     Audio file with ID3 version 2.4.0, contains:MPEG ADTS, layer III, v2,  64 kbps, 22.05 kHz, Monaural
en-59_jas-005.mp3:     Audio file with ID3 version 2.4.0, contains:MPEG ADTS, layer III, v2,  64 kbps, 22.05 kHz, Monaural
es-59_jas-005.mp3:     Audio file with ID3 version 2.4.0
it-59_jas-005.mp3:     Audio file with ID3 version 2.4.0, contains:MPEG ADTS, layer III, v2,  64 kbps, 22.05 kHz, Monaural
nl-59_jas-005.mp3:     Audio file with ID3 version 2.4.0
pt-59_jas-005.mp3:     Audio file with ID3 version 2.4.0, contains:MPEG ADTS, layer III, v2,  64 kbps, 22.05 kHz, Monaural

I don’t know why file gets a different response with the Spanish and Dutch.  For all seven, I opened a file already in Music, used Amadeus Pro to replace the audio from a downloaded MP3, and saved back to the original location.  In order for Music to not change the file name, I leave all the tags the same except lyrics.  The lyrics, I replace with the text downloaded from the same website as the audio.  This is done with the same command for all seven:

eyeD3 --encoding utf8 --add-lyrics (lyrics file) \
                                   (audio file)  > /dev/null

(Redirection is to suppress printing ALL the tags including lyrics after the replacement.)  The copying out is done after the replacement in Music.  I also sync to an iPad after, so I can listen and scroll the lyrics at the same time.

In Apple's TextEdit, all of the text files are rendered correctly.  In the iPad and on the laptop, five lyrics are rendered correctly in Music, but in Italian and Spanish, all non-ASCII characters are rendered as if ISOLatin1. The Apple OS, shell, and TextEdit are set to use UTF-8 for everything. Music does not have a setting for encoding, but always gets it correct if I type it in or paste it in.

Greek, Spanish, and Portuguese also have non-ASCII characters in the title and album, which are similarly trashed, when the eyeD3 command did not specify a change in those. But the Greek and Portuguese lyrics still render correctly.

WGroleau commented 2 years ago

See also https://apple.stackexchange.com/questions/435660/utf-8-characters-rendered-isolatin1-in-music-but-not-every-time

WGroleau commented 2 years ago

Did some complicated testing and confirmed that this is not a bug in eyeD3. The audio editor, if any tag is changed, re-writes all of them with the wrong encoding.