Skip to content

Commit

Permalink
fix StopIteration when charset of font is UTF-8 (vs utf8)
Browse files Browse the repository at this point in the history
  • Loading branch information
kienerj committed Mar 13, 2024
1 parent 6064190 commit 512afb1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pycdxml/cdxml_converter/chemdraw_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ def from_element(fonttable: ET.Element) -> 'CDXFontTable':
for font in fonttable.iter(tag="font"):
logger.debug(f"Reading font {font.attrib}.")
font_id = int(font.attrib["id"])
if font.attrib["charset"] == "UTF-8":
font.attrib["charset"] = "utf8"
charset = next(key for key, value in Font.CHARSETS.items() if value == font.attrib["charset"])
font_name = font.attrib["name"]
fonts.append(Font(font_id, charset, font_name))
Expand Down

0 comments on commit 512afb1

Please sign in to comment.