From 0fd9bab2d4822c3682dd213e4028789fb8707401 Mon Sep 17 00:00:00 2001
From: "Matteo Nastasi (mop)" <nastasi@alternativeoutput.it>
Date: Mon, 12 Nov 2012 18:15:39 +0100
Subject: [PATCH] explicit mb_substr to dimension usernames and chat lines

---
 web/Obj/brisk.phh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh
index 0c94fce..586f0d9 100644
--- a/web/Obj/brisk.phh
+++ b/web/Obj/brisk.phh
@@ -1219,7 +1219,7 @@ class Room {
     $only_you = FALSE;
     
     // common settings
-    $msg = substr($mesg, 6, 128);
+    $msg = mb_substr($mesg, 6, 128, "UTF-8");
     $curtime = time();
     $dt = date("H:i ", $curtime);
     $target = "";
@@ -2677,7 +2677,7 @@ function validate_sess($sess)
 
 function validate_name($name) 
 {
-  $name_new = str_replace(' ', '_', substr(trim($name),0,12));
+    $name_new = str_replace(' ', '_', mb_substr(trim($name),0,12, "UTF-8"));
 
   for ($i = 0 ; $i < strlen($name_new) ; $i++) {
     $c = $name_new[$i];
-- 
2.17.1