Show More
@@ -32,12 +32,12 b" def source_to_unicode(txt, errors='replace', skip_encoding_cookie=True):" | |||
|
32 | 32 | except SyntaxError: |
|
33 | 33 | encoding = "ascii" |
|
34 | 34 | buffer.seek(0) |
|
35 |
|
|
|
36 | text.mode = 'r' | |
|
37 | if skip_encoding_cookie: | |
|
38 | return u"".join(strip_encoding_cookie(text)) | |
|
39 | else: | |
|
40 | return text.read() | |
|
35 | with TextIOWrapper(buffer, encoding, errors=errors, line_buffering=True) as text: | |
|
36 | text.mode = 'r' | |
|
37 | if skip_encoding_cookie: | |
|
38 | return u"".join(strip_encoding_cookie(text)) | |
|
39 | else: | |
|
40 | return text.read() | |
|
41 | 41 | |
|
42 | 42 | def strip_encoding_cookie(filelike): |
|
43 | 43 | """Generator to pull lines from a text-mode file, skipping the encoding |
General Comments 0
You need to be logged in to leave comments.
Login now