Posted by Markus Ernst on 01/12/06 15:10
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
anything. I wonder if there is a solution for this that works without
using strtr() (which means defining every single uppercase/lowercase
pair to be converted)?
Also I was not able to find informations about the validity space of
setlocale(). Can I set the locale at the top of a script and it will
remain set in all functions and objects, or do I have to set it before
every call of a function that is locale-specific?
BTW I use PHP 4.3.
Thanks for every hint!
Markus
[Back to original message]
|