Unicode was a mistake </3

This commit is contained in:
Dpeta 2021-04-01 22:15:38 +02:00
parent 5e473e1957
commit 67e544effc
2 changed files with 12 additions and 1 deletions

View file

@ -1,6 +1,9 @@
# Changelog # Changelog
(This document uses YYYY-MM-DD as per ISO 8601) (This document uses YYYY-MM-DD as per ISO 8601)
## [v2.0.1] - 2021-4-1
- Fixed encoding-related crash
## [v2.0] - 2021-3-25 ## [v2.0] - 2021-3-25
### Added ### Added

View file

@ -46,7 +46,15 @@ def parse_raw_irc_command(element):
<crlf> ::= CR LF <crlf> ::= CR LF
""" """
element = element.decode("utf-8") try:
element = element.decode("utf-8")
except:
try:
element = element.decode("latin-1")
except:
# This shouldn't happen, but if it does:
element = ""
parts = element.strip().split(" ") parts = element.strip().split(" ")
if parts[0].startswith(':'): if parts[0].startswith(':'):
prefix = parts[0][1:] prefix = parts[0][1:]