Unexpected UTF-8 BOM (decode using utf-8-sig) - 简书
文章推薦指數: 80 %
原因分析:text包含BOM字符解决方案:将BOM头去掉. 问题描述: json.loads(text,encoding='utf8') 报Unexpected UTF-8 BOM (decode using utf-8-sig)错误 ...
延伸文章資訊
- 1Byte order mark - Globalization - Microsoft Learn
- 2What is the difference between utf-8 and utf-8-sig? - Stack Overflow
- 3json.decoder.JSONDecodeError: Unexpected UTF ... - 程式人生
JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 ... #!/usr/bin/env Python ...
- 4Python load json file with UTF-8 BOM header - Stack Overflow
You can open with codecs : import json import codecs json.load(codecs.open('sample.json', 'r', 'u...
- 5Why Python 3 doesn't write the Unicode BOM - Peter Bloomfield