Java 使用jid3lib将Unicode读/写至ID3v2

Java 使用jid3lib将Unicode读/写至ID3v2,java,mp3,id3-tag,id3v2,Java,Mp3,Id3 Tag,Id3v2,我正在尝试使用jid3lib编写一个应用程序,在读/写id3v1方面几乎一切都正常,但对于v2 unicode,我无法找到将unicode转换为可用字符串,然后重新编码以写回帧的最佳方法 我找到了CharsetDecoder和CharsetEncoder,但它们似乎没有改变任何东西 MP3File mp3file = new MP3File(f); AbstractID3v2 tag = mp3file.getID3v2Tag(); String title = tag.getSongTitle

我正在尝试使用jid3lib编写一个应用程序,在读/写id3v1方面几乎一切都正常,但对于v2 unicode,我无法找到将unicode转换为可用字符串,然后重新编码以写回帧的最佳方法

我找到了CharsetDecoder和CharsetEncoder,但它们似乎没有改变任何东西

MP3File mp3file = new MP3File(f);
AbstractID3v2 tag = mp3file.getID3v2Tag();
String title = tag.getSongTitle();
System.out.println("Title : " + convertCharset(title));
其中convertCharset是:

private static String convertCharset(String text) {
    Charset charset = Charset.forName("ISO-8859-1");
    CharsetDecoder decoder = charset.newDecoder();
    CharsetEncoder encoder = charset.newEncoder();
    try {
        ByteBuffer bbuf = encoder.encode(CharBuffer.wrap(text));
        CharBuffer cbuf = decoder.decode(bbuf);
        return cbuf.toString();
    } catch (CharacterCodingException e) {
        e.printStackTrace();
    }
    return null;
}
输出结果如下所示:

非常感谢您的帮助