Skip to content

please detect encoding before opening a file #88

@HaujetZhao

Description

@HaujetZhao

Please introduce modules to detect file encoding.

chardet is an option.

The default behavior of rich-cli opening a file is using system prefered encoding. Windows in some different country have different locale encoding.

So rich-cli will raise error if attempt to open utf-8 files.

The solution is: open file in bytes mode, read the bytes, detect the encoding using chardet module, decode the bytes to text content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions