D
D
DragoN DragoN2017-07-16 07:31:45
Java
DragoN DragoN, 2017-07-16 07:31:45

How to get ID3 in correct encoding?

I use MediaMetadataRetriever to get tags, but Russian tags are sometimes in ISO-8859-1, which should be read when translated into Windows-1251, but this doesn’t happen for me and it displays hieroglyphs all the time
.
Must be: I want to be with you

String TEXT = META.extractMetadata( MediaMetadataRetriever.METADATA_KEY_TITLE );
new String( TEXT.getBytes( "ISO-8859-1" ), "Windows-1251" ); // Практически всегда выводит иероглифы

Found a library and decided to use it to test
mp3file = new MP3File( FILE );
new String( mp3file.getID3v1Tag().getSongTitle().getBytes( "ISO-8859-1" ), "Windows-1251" ) // Выводит текст как надо, но иногда вместо кириллических символов проскальзывают латинские

Tell me how to determine the encoding and decode it into a readable form. I think there is a native way

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Varakosov, 2017-07-16
@thelongrunsmoke

This is the problem with the standard itself. Tags should always be in ISO-8859-1, but in reality they are usually in national encodings.
I think the best solution is to let the user choose their own encoding.

A
apro, 2017-07-16
@apro

There is a library for automating encoding guesses: enca cihar.com/software/enca can be picked up using ndk,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question