Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
6a199545
Commit
6a199545
authored
Nov 23, 2006
by
Walter Dörwald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change decode() so that it works with a buffer (i.e. unicode(..., 'utf-8-sig'))
SF bug #1601501.
parent
f9d8005b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
Lib/encodings/utf_8_sig.py
Lib/encodings/utf_8_sig.py
+1
-1
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+4
-0
No files found.
Lib/encodings/utf_8_sig.py
View file @
6a199545
...
...
@@ -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
)
...
...
Lib/test/test_codecs.py
View file @
6a199545
...
...
@@ -425,6 +425,10 @@ class UTF8SigTest(ReadTest):
]
)
def
test_bug1601501
(
self
):
# SF bug #1601501: check that the codec works with a buffer
unicode
(
"
\
xef
\
xbb
\
xbf
"
,
"utf-8-sig"
)
class
EscapeDecodeTest
(
unittest
.
TestCase
):
def
test_empty
(
self
):
self
.
assertEquals
(
codecs
.
escape_decode
(
""
),
(
""
,
0
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment