|
Posted by Kimmo Laine on 01/12/06 15:20
"Markus Ernst" <derernst@NO#SP#AMgmx.ch> wrote in message
news:43c6502d$1_1@news.cybercity.ch...
> Hi
>
> In a multilanguage application I need the ucfirst() functionality. As this
> function is not multibyte-compatible I tried a function suggested in the
> manual:
>
> function my_mb_ucfirst($str) {
> $fc = mb_strtoupper(mb_substr($str, 0, 1));
> return $fc.mb_substr($str, 1);
> }
>
> The test:
>
> echo my_mb_ucfirst("δhnlich");
>
> prints "δhnlich". Also setlocale(LC_ALL, 'de_DE'); does not change
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);
}
--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|