Giter Club home page Giter Club logo

Comments (7)

cdhigh avatar cdhigh commented on June 4, 2024 1

chardet return latin1 when title contains chars Chineses.
I think chardet needs more characters to determine the encoding, not enough characters in the title

from tinytag.

cdhigh avatar cdhigh commented on June 4, 2024

Added: ID3V2 has same bug.

from tinytag.

cdhigh avatar cdhigh commented on June 4, 2024

I try with locale module, it works.
locale.getpreferredencoding(False)
or
decode using locale.getpreferredencoding(False), if failed, try 'latin1'?

from tinytag.

devsnd avatar devsnd commented on June 4, 2024

Hey cdhigh,

I have another idea to make this possible that is similar to your PR, which is to use chardet instead of the system locale. Maybe you can make a test using that library and we could add it as optional dependency to tinytag.

Chardet uses the "letter-frequency" of the bytes to determine which encoding might be successfully used.

https://pypi.org/project/chardet/

from tinytag.

devsnd avatar devsnd commented on June 4, 2024

Hey @cdhigh ,

Could you please provide a sample file so I can reproduce the bug?

from tinytag.

cdhigh avatar cdhigh commented on June 4, 2024

https://we.tl/t-cs2f6K6j66

from tinytag.

devsnd avatar devsnd commented on June 4, 2024

Hey @cdhigh

Thanks for providing a sample file, I was able to reproduce the bug. Unfortunately, there is no way to automatically detect the correct encoding for gbk encoded files. (As you also saw, chardet misdetects it as another encoding).

I don't want to fill the library with code that guesses encodings based on system settings and whatnot, so instead I opted to allow for overriding the default encoding.

You can now use TinyTag.get(filename, encoding='gbk') and it will then use gbk encoding whenever no encoding has been specified inside of the mp3 file. Since gbk also contains the ASCII character set, this should work pretty well for you, even when you also have english files in between.

You can use the version in the master branch until I release a new version containing the feature.

from tinytag.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.