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

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

 

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

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