You are here: Re: ucfirst and utf-8; setlocale « All PHP « IT news, forums, messages
Re: ucfirst and utf-8; setlocale

Posted by Kimmo Laine on 01/13/06 09:00

"Markus Ernst" <derernst@NO#SP#AMgmx.ch> wrote in message
news:43c66299$1_2@news.cybercity.ch...
> 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.
>

Of course I don't mind :) It's not a secret or anything...

--
"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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация