csplitter fixed multibytes bug
[brisk.git] / web / Obj / brisk.phh
index 6cb7f29..f52cfb3 100644 (file)
@@ -290,19 +290,20 @@ function csplitter($in, $sep)
   $out = array();
   $out[$id] = "";
   for ($i = 0 ; $i < strlen($in) ; $i++) {
+    $ini = substr($in, $i, 1);
     if ($st == 0) {
-      if ($in{$i} == '\\')
+      if ($ini == '\\')
         $st = 1;
-      else if ($in{$i} == $sep) {
+      else if ($ini == $sep) {
         $id++;
         $out[$id] = "";
       }
       else {
-        $out[$id] .= $in{$i};
+        $out[$id] .= $ini;
       }
     }
     else if ($st == 1) {
-      $out[$id] .= $in{$i};
+      $out[$id] .= $ini;
       $st = 0;
     }
   }
@@ -310,7 +311,6 @@ function csplitter($in, $sep)
   return ($out);
 }
 
-
 function xcape($s)
 {
   $from = array (   '\\',     '@',        '|' );