Handle chars and not bytes for usernames :-p
authorunc0rr
Thu, 23 Jan 2014 21:54:26 +0400
changeset 10063 52e293f14977
parent 10062 8ef80bd0402f
child 10064 bf1a5ef4ef14
Handle chars and not bytes for usernames :-p
gameServer/Utils.hs
--- a/gameServer/Utils.hs	Thu Jan 23 14:18:06 2014 +0100
+++ b/gameServer/Utils.hs	Thu Jan 23 21:54:26 2014 +0400
@@ -56,8 +56,9 @@
             t : replaceTeam tm ts
 
 illegalName :: B.ByteString -> Bool
-illegalName s = B.null s || B.length s > 40 || B.all isSpace s || isSpace (B.head s) || isSpace (B.last s) || B.any isIllegalChar s
+illegalName b = B.null b || length s > 40 || all isSpace s || isSpace (head s) || isSpace (last s) || any isIllegalChar s
     where
+        s = UTF8.toString b
         isIllegalChar c = c `List.elem` ("$()*+?[]^{|}\x7F" ++ ['\x00'..'\x1F'])
 
 protoNumber2ver :: Word16 -> B.ByteString