1. We need replace for function strlen because strlen unable to count non-english characters correctly in multi-byte strings (for example, utf8).
Open functions/text.php and add following lines to „text“ class. For example, on line #822, after get_smilies function: public function utf8_strlen($s) {
$c = strlen($s); $l = ;
for ($i = ; $i < $c; ++$i) if ((ord($s[$i]) & 0xC0) != 0x80) ++$l;
return $l;
}
2. Make Diferior use utf8_strlen instead of strlen. Open functions/user.php and change line #218 to $strl_user = $text -> utf8_strlen ( $user );
line #625 to $strl_name = $text -> utf8_strlen ( $name );
3. Make Diferior allow non-english characters in names and usernames. Open functions/text.php and change line #527 to return (bool)preg_match ( "#^[\pL0-9_\-\+\.,:@%\^\*=\[\]{}]+\$#", $str );
line #535 to return (bool)preg_match ( "#^[\pL0-9, ]+\$#i", $str );
I don't know if code clean or dirty but that solves my problem with russian names.
Blog posts: 11
Added downloads: 2 Comments: 18 Forum posts: 572
Open functions/text.php and add following lines to „text“ class. For example, on line #822, after get_smilies function:
public function utf8_strlen($s) { $c = strlen($s); $l = ; for ($i = ; $i < $c; ++$i) if ((ord($s[$i]) & 0xC0) != 0x80) ++$l; return $l; }
2. Make Diferior use utf8_strlen instead of strlen.
Open functions/user.php and change
line #218 to
$strl_user = $text -> utf8_strlen ( $user );
line #625 to
$strl_name = $text -> utf8_strlen ( $name );
3. Make Diferior allow non-english characters in names and usernames.
Open functions/text.php and change
line #527 to
return (bool)preg_match ( "#^[\pL0-9_\-\+\.,:@%\^\*=\[\]{}]+\$#", $str );
line #535 to
return (bool)preg_match ( "#^[\pL0-9, ]+\$#i", $str );
I don't know if code clean or dirty but that solves my problem with russian names.
Added downloads: 2
Comments: 18
Forum posts: 572