From 51457f3550235ca99d5fffb1391b91a3ed467484 Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 13 Jul 2016 13:38:56 -0700 Subject: [PATCH] Irc: treat unicode case sensitively in toLower() --- classes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes.py b/classes.py index 5ce2dfd..15ea2e5 100644 --- a/classes.py +++ b/classes.py @@ -486,7 +486,10 @@ class Irc(): text = text.replace('}', ']') text = text.replace('|', '\\') text = text.replace('~', '^') - return text.lower() + # Encode the text as bytes first, and then lowercase it so that only ASCII characters are + # changed. Unicode in channel names, etc. is case sensitive because IRC is just that old of + # a protocol!!! + return text.encode().lower().decode() def parseModes(self, target, args): """Parses a modestring list into a list of (mode, argument) tuples.