Closed ppvv6688 closed 2 years ago
f.write() 试着用encoding='utf8',如果你的文件是用utf8格式读的,写的时候因为默认是gbk,所以可能会出错
f.write()试着用encoding ='utf8',如果你的文件是用utf8格式读的,写的时候因为只是是gbk,所以可能会出错
去包里源文件修改么?我不太会啊
f.write()试着用encoding ='utf8',如果你的文件是用utf8格式读的,写的时候因为只是是gbk,所以可能会出错
去包里源文件修改么?我不太会啊
f.write(json.dumps(self.to_dict(), indent=2, ensure_ascii=False), encoding ='utf8' )
谢谢
新版本应该已修复,在测试看看~
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
You must follow the issue template and provide as much information as possible. otherwise, this issue will be closed. 请按照 issue 模板要求填写信息。如果没有按照 issue 模板填写,将会忽略并关闭这个 issue
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
You can post pictures, but if specific text or code is required to reproduce the issue, please provide the text in a plain text format for easy copy/paste.
Environment
Question
model.save() 小白做这个,出现以下错误,请问怎么解决?感谢!
File "D:\ProgramData\Anaconda3\lib\site-packages\kashgari\tasks\abs_task_model.py", line 84, in save f.write(json.dumps(self.to_dict(), indent=2, ensure_ascii=False))
UnicodeEncodeError: 'gbk' codec can't encode character '\xa1' in position 98690: illegal multibyte sequence