Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encoding bug in RSC image character handling #9

Merged
merged 2 commits into from
Oct 13, 2016
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions chemdataextractor/scrape/pub/rsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def replace_rsc_img_chars(document):
if not u2 and u1 in RSC_IMG_CHARS:
rep = RSC_IMG_CHARS[u1]
else:
rep = (b'\u%s' % u1).decode('unicode-escape')
rep = ('\\u%s' % u1).encode('ascii').decode('unicode-escape')
if u2:
rep += (b'\u%s' % u2).decode('unicode-escape')
rep += ('\\u%s' % u2).encode('ascii').decode('unicode-escape')
if img.tail is not None:
rep += img.tail # Make sure we don't remove any tail text
parent = img.getparent()
Expand Down
Loading