0

I'm trying to retrieve ID3 tags from mp3 files by using Java ID3Tag Library. But I get some errors while retrieving strings with special characters (çáêü...). So I've converted these strings to byte arrays:

ID3v2_4 tag=(ID3v2_4) mp3file.getID3v2Tag();
byte [] artBytes=tag.getLeadArtist().getBytes();
for (int i=0;i<artBytes.length;i++){
   System.out.println(artBytes[i]);
}

And then I've found that every "unknown" char (as well as the first bytes in the string) has been read as the three-byte sequence -17 -65 -67 ("�&quot; in the string). Also, after each letter there is a byte 0. So, if I want to read "Blue Öyster Cult" ,I get something like "��B l u e � y s t e r C u l t".

What can I do to normalize these strings?

[EDIT]

  • A few mp3 files with special characters are displayed correctly.

  • Reading from charsets like US_ASCII or ISO_8859_1 will cause the char � to be displayed as byte 63.

4

1 回答 1

0

正如 immibis 所说,这可能是图书馆中的一个错误。我最终使用了mp3agic库,一切正常。

于 2015-02-21T01:28:16.690 回答