|
Posted by Markus Ernst on 01/12/06 16:29
Kimmo Laine schrieb:
>
> You could try it with passing the character encoding to the mb_strtoupper
> function:
>
> function my_mb_ucfirst($str) {
> $fc = mb_strtoupper(mb_substr($str, 0, 1), 'utf-8');
> return $fc.mb_substr($str, 1);
> }
Thank you, you pointed me to the right direction. Though I set
ini_set("default_charset", "utf-8") at the beginning of the script, it
seems to be necessary to pass the encoding to each mb function which
makes it a complicated thing for an easy task:
function my_mb_ucfirst($str, $e='utf-8') {
$fc = mb_strtoupper(mb_substr($str, 0, 1, $e), $e);
return $fc.mb_substr($str, 1, mb_strlen($str, $e), $e);
}
I hope you don't mind if I post this to the manual, as it might be
interesting for others.
--
Markus
Navigation:
[Reply to this message]
|