mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Change decode() so that it works with a buffer (i.e. unicode(..., 'utf-8-sig'))
SF bug #1601501.
This commit is contained in:
parent
4ebbefe677
commit
39b8b6afb5
2 changed files with 5 additions and 1 deletions
|
@ -16,7 +16,7 @@ def encode(input, errors='strict'):
|
|||
|
||||
def decode(input, errors='strict'):
|
||||
prefix = 0
|
||||
if input.startswith(codecs.BOM_UTF8):
|
||||
if input[:3] == codecs.BOM_UTF8:
|
||||
input = input[3:]
|
||||
prefix = 3
|
||||
(output, consumed) = codecs.utf_8_decode(input, errors, True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue