Skip to content

Commit

Permalink
improve non-ASCII logic with metar parser, python2.7 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akrherz committed Jun 18, 2018
1 parent 737beea commit e90c177
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyiem/nws/products/metarcollect.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ def sanitize(text):
text = re.sub("\015", " ", text)
# Remove any multiple whitespace, bad chars
# daryl does not understand all of what follows as far as encode/decode
text = text.encode().replace(b'\xa0', b" ").replace(b"\001", b"")
text = text.encode('utf-8', 'ignore'
).replace(b'\xa0', b" ").replace(b"\001", b"")
text = text.replace(b"\003", b""
).replace(b"COR ", b"").decode('utf-8', errors='ignore')
text = " ".join(text.strip().split())
Expand Down

0 comments on commit e90c177

Please sign in to comment.