My main machine is macOS, and the previous versions of rimetool were all developed on macOS.
Today, a new partner joined whose main machine is Windows. We found that rimetool reports an error about GBK encoding right after starting to use it:
(base) J:\rime>rimetool --input-path J:\rime\rimetool-master\rimetool-master\examples\contacts.vcf --tool vcf
Traceback (most recent call last):
File "\\?\E:\Anaconda\Scripts\rimetool-script.py", line 33, in <module>
sys.exit(load_entry_point('rimetool==0.1.6.2', 'console_scripts', 'rimetool')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\Anaconda\Lib\site-packages\rimetool\main.py", line 30, in main
vcf.main(args.input_path, args.output_path)
File "E:\Anaconda\Lib\site-packages\rimetool\utils\vcf.py", line 20, in main
for line in infile:
^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa0 in position 422: illegal multibyte sequence
We communicated for a while, and suddenly I realized that Windows uses GBK encoding by default, macOS uses UTF-8 encoding by default, and rimetool currently does not hardcode which encoding to use for reading and writing files.
This causes the file output by rimetool on macOS to be in UTF-8 format, and when this file is downloaded to Windows and read by rimetool, it reports an encoding error.
In the subsequent bug fix, just hardcode both the reading and writing encoding to a certain one.