Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
时间: 2024-04-25 14:24:36 浏览: 182
回答: 这个错误是由于在解码UTF-8编码的字符串时遇到了意外的UTF-8 BOM(字节顺序标记)引起的。UTF-8编码不需要BOM,而且在解码过程中,即使在解码的Unicode字符串中遇到U+FEFF字符(即BOM),它也会被视为零宽度不换行空格。\[1\]\[2\]要解决这个问题,可以尝试使用utf-8-sig编码来解码字符串,这样可以忽略BOM。另外,你也可以参考相关的文章或博客来了解更多关于这个问题的解决方法。\[3\]
#### 引用[.reference_title]
- *1* *2* [python通过json库去读取json文件里面的内容](https://blog.csdn.net/qq_40258091/article/details/86768061)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [python用requests发请求,返回的json数据,用print(re.json)时报错:Unexpected UTF-8 BOM (decode using ...](https://blog.csdn.net/m0_72211532/article/details/128018377)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文