Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading Chinese encoded tags seems to sometimes have problems. #197

Open
joe-vettek opened this issue Sep 8, 2022 · 1 comment
Open

Comments

@joe-vettek
Copy link

joe-vettek commented Sep 8, 2022

my code is like this:

                mp3file.save(basePath + tt);
                id3v22Tag.setEncoder("2");
                mp3file.setId3v2Tag(id3v22Tag);
                id3v22Tag = mp3file.getId3v2Tag();
                if (id3v22Tag.getAlbum() != null && !id3v22Tag.getAlbum().isEmpty()) 
                    this.album = id3v22Tag.getAlbum();

I've tried tweaking the encoder to salvage the bad encoding, but it doesn't seem to work.
The library outputs UTF-8 encoding by default, while Chinese encoding is sometimes GBK.
But the result always shows like this:
OutPut: ×÷´Ê£ºFinale ×÷Çú/±àÇú/Ñݳª£ººÓͼ
Actually: 2008作词:Finale 作曲/编曲/演唱:
The setEncoder function doesn't seem to do anything.

@joe-vettek
Copy link
Author

joe-vettek commented Sep 9, 2022

Ok, I found a simple way to solve it. Just check the encoder of the output, and then convert it into the encoder you want.

Log.d(TAG, "alertMp3Info: "+ SimpleTool.getEncoding(id3v22Tag.getAlbum())+id3v22Tag.getAlbum());
Log.d(TAG, "alertMp3Info: "+ new String(id3v22Tag.getAlbum().getBytes("ISO-8859-1"),"gbk"));

SimpleTool.getEncoding is a method to determine which encoding it is. It depends on what language you are.

refer: https://community.mp3tag.de/t/convert-charset-encoding/14360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant