Giter Site home page Giter Site logo

mbstrdecoder's Introduction

mbstrdecoder

Summary

mbstrdecoder is a Python library for multi-byte character string decoder.

PyPI package version

image

Supported Python implementations

CI status of Linux/macOS/Windows

Test coverage

CodeQL

Installation

Install from PyPI

pip install mbstrdecoder

Install from PPA (for Ubuntu)

sudo add-apt-repository ppa:thombashi/ppa
sudo apt update
sudo apt install python3-mbstrdecoder

Usage

Sample Code
from mbstrdecoder import MultiByteStrDecoder

encoded_multibyte_text = "マルチバイト文字".encode("utf-8")
decoder = MultiByteStrDecoder(encoded_multibyte_text)

print("encoded bytes: {}".format(encoded_multibyte_text))
print("unicode: {}".format(decoder.unicode_str))
print("codec: {}".format(decoder.codec))
Output
encoded bytes: b'\xe3\x83\x9e\xe3\x83\xab\xe3\x83\x81\xe3\x83\x90\xe3\x82\xa4\xe3\x83\x88\xe6\x96\x87\xe5\xad\x97'
unicode: マルチバイト文字
codec: utf_8

Dependencies

mbstrdecoder's People

Contributors

jayvdb avatar karolinku avatar thombashi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mbstrdecoder's Issues

GB18030

GB18030 encoded text is being detected as utf_16, big5 and cp037, and only big5 can decode it.

Detection as utf_16 is very wrong as that codec must contain the utf16 BOM, so the library should be very cautious about that result, but chardet has a patch to do exactly that chardet/chardet#109

The GB18030 BOM tends to result in detection as cp037 The BOM is regularly causing problems in chardet-like-libraries. c.f. chardet/chardet#178

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.