Skip to content

Commit d593f84

Browse files
committed
Socket: disable charset heuristics when the server advertizes UTF8ONLY.
1 parent db05081 commit d593f84

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/drivers/Socket.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,13 @@ def _read(self):
212212
lines = self.inbuffer.split(b'\n')
213213
self.inbuffer = lines.pop()
214214
for line in lines:
215-
line = decode_raw_line(line)
215+
if self.irc is not None \
216+
and 'UTF8ONLY' in self.irc.state.supported:
217+
# No need for the fancy charset-guessing used in
218+
# decode_raw_line.
219+
line = line.decode('utf8')
220+
else:
221+
line = decode_raw_line(line)
216222

217223
msg = drivers.parseMsg(line)
218224
if msg is not None and self.irc is not None:

0 commit comments

Comments
 (0)