Socket: disable charset heuristics when the server advertizes UTF8ONLY.

This commit is contained in:
Valentin Lorentz 2021-08-27 19:03:18 +02:00
parent db05081ff6
commit d593f84a66
1 changed files with 7 additions and 1 deletions

View File

@ -212,7 +212,13 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
lines = self.inbuffer.split(b'\n')
self.inbuffer = lines.pop()
for line in lines:
line = decode_raw_line(line)
if self.irc is not None \
and 'UTF8ONLY' in self.irc.state.supported:
# No need for the fancy charset-guessing used in
# decode_raw_line.
line = line.decode('utf8')
else:
line = decode_raw_line(line)
msg = drivers.parseMsg(line)
if msg is not None and self.irc is not None: