Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Get rid of obsolete replacement of unpaired surrogates with U+FFFD.#175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gsnedders merged 1 commit intohtml5lib:masterfromgsnedders:fix_tokenizer_201411
Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified.pytest.expect
View file
Open in desktop
Binary file not shown.
9 changes: 1 addition & 8 deletionshtml5lib/inputstream.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -185,14 +185,10 @@ def __init__(self, source):
# Such platforms will have already checked for such
# surrogate errors, so no need to do this checking.
self.reportCharacterErrors = None
self.replaceCharactersRegexp = None
elif len("\U0010FFFF") == 1:
self.reportCharacterErrors = self.characterErrorsUCS4
self.replaceCharactersRegexp = re.compile(eval('"[\\uD800-\\uDFFF]"'))
else:
self.reportCharacterErrors = self.characterErrorsUCS2
self.replaceCharactersRegexp = re.compile(
eval('"([\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF])"'))

# List of where new lines occur
self.newLines = [0]
Expand DownExpand Up@@ -290,10 +286,7 @@ def readChunk(self, chunkSize=None):
if self.reportCharacterErrors:
self.reportCharacterErrors(data)

# Replace invalid characters
# Note U+0000 is dealt with in the tokenizer
data = self.replaceCharactersRegexp.sub("\ufffd", data)

# Replace invalid characters
data = data.replace("\r\n", "\n")
data = data.replace("\r", "\n")

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp