Issue #28541: Improve test coverage for encoding detection in json library.

Original patch by Eric Appelt.
This commit is contained in:
Serhiy Storchaka 2016-10-30 23:00:01 +02:00
parent a0d9c685d0
commit c4a35daa97
2 changed files with 15 additions and 1 deletions

View file

@ -257,7 +257,8 @@ def detect_encoding(b):
return 'utf-16-be' if b[1] else 'utf-32-be'
if not b[1]:
# XX 00 00 00 - utf-32-le
# XX 00 XX XX - utf-16-le
# XX 00 00 XX - utf-16-le
# XX 00 XX -- - utf-16-le
return 'utf-16-le' if b[2] or b[3] else 'utf-32-le'
elif len(b) == 2:
if not b[0]: