Gestion de l'UTF-8
This commit is contained in:
parent
13950bc000
commit
9c97dcb57d
@ -24,12 +24,15 @@ function initstr($chaine, $taille, $caractere_pour_combler=' ', $align=ALIGN_LEF
|
||||
return substr($chaine, 0, $taille);
|
||||
}
|
||||
|
||||
$encoding = mb_internal_encoding();
|
||||
$diff = strlen($chaine) - mb_strlen($chaine, $encoding);
|
||||
|
||||
if ($align == ALIGN_RIGHT) {
|
||||
return str_pad($chaine ,$taille, $caractere_pour_combler, STR_PAD_LEFT);
|
||||
}
|
||||
return str_pad($chaine, $taille + $diff, $caractere_pour_combler, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
if ($align == ALIGN_LEFT) {
|
||||
return str_pad($chaine, $taille, $caractere_pour_combler, STR_PAD_RIGHT);
|
||||
return str_pad($chaine, $taille + $diff, $caractere_pour_combler, STR_PAD_RIGHT);
|
||||
}
|
||||
|
||||
return $str;
|
||||
|
Loading…
Reference in New Issue
Block a user