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.
Please introduce modules to detect file encoding.
chardetis 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
chardetmodule, decode the bytes to text content.