Skip to content

Commit

Permalink
Merge pull request #31 from moisespr123/master
Browse files Browse the repository at this point in the history
Encode string to UTF-8 to prevent issues where ASCII fails to decode characters
  • Loading branch information
ChrisBarker-NOAA committed May 18, 2022
2 parents 59ef3aa + 725c72b commit 0e367e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nucos/unit_conversion.py
Expand Up @@ -168,8 +168,10 @@ def FindUnitTypes():
if (unit_type, n) in [("volume", "oz"),
("density", "s")]:
continue

print(f"Adding: {unit_type}: {n}")
try:
print(f"Adding: {unit_type}: {n}")
except UnicodeEncodeError:
print(f"Adding: {unit_type}: {n}".encode("utf-8"))
if n in unit_types:
raise ValueError("Duplicate name in units table: %s" % n)

Expand Down

0 comments on commit 0e367e2

Please sign in to comment.