gameServer/Utils.hs
changeset 2403 6c5d504af2ba
parent 2381 959da8402cac
child 2448 30b4a7c8e9b2
--- a/gameServer/Utils.hs	Fri Oct 02 18:56:54 2009 +0000
+++ b/gameServer/Utils.hs	Sat Oct 03 09:35:14 2009 +0000
@@ -28,7 +28,9 @@
 		$ concatMap (\n -> (\(a, b) -> [showHex a, showHex b]) $ divMod n 65536) [a, b, c, d]) []
 
 toEngineMsg :: String -> String
-toEngineMsg msg = Base64.encode (fromIntegral (length msg) : (UTF8.encode msg))
+toEngineMsg msg = Base64.encode (fromIntegral (length encodedMsg) : encodedMsg)
+	where
+	encodedMsg = UTF8.encode msg
 
 fromEngineMsg :: String -> Maybe String
 fromEngineMsg msg = liftM (map w2c) (Base64.decode msg >>= removeLength)