Question

I am trying to read tags of Russian songs in Java using mp3agic:

Mp3File song;
try {
    song = new Mp3File(newURI);
    if (song.hasId3v2Tag()) {
        ID3v2 id3v2tag  = song.getId3v2Tag();
        title   = id3v2tag.getTitle();
        artist  = id3v2tag.getArtist();
    }
    else if (song.hasId3v1Tag()){
        ID3v1 id3v1tag  = song.getId3v1Tag();
        title   = id3v1tag.getTitle();
        artist  = id3v1tag.getArtist();
    }
}

However I get this "??-2????????? ?????" instead of this "Би-2Скользкие Улицы". What can I do to resolve this issue?

Was it helpful?

Solution

An explanation of this issue can be found at: https://github.com/mpatric/mp3agic/issues/39

In summary, the problem is that the text encoding is windows-1251 (also known as cp1251). ID3v2 tags with windows-1251 encoded strings (or any other encoding that's not one of the 4 supported encodings for ID3v2) are not valid. Programatically differentiating windows-1251 from iso-8859-1 is not easy, so automatically detecting the strings in order to transcode them might be tricky.

Some interesting comments here: https://superuser.com/questions/495775/how-to-translate-wacky-metadata-to-readable-format

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top