Jump to content

Convert upper to lower case


mikaint

Recommended Posts

HI,
I'm trying to convert some words to upper and lower case, using strtoupper() and strtolower() functions, and also ucwords() for capitalization of the first letter of those words. I'm using both greek and english languages, which are stored in my db using utf-8 encoding. All the functions are working for words in english, but not for words in greek. Can anybody help me with this? thanx.
Link to comment
https://forums.phpfreaks.com/topic/27081-convert-upper-to-lower-case/
Share on other sites

You need to use the [url=http://us2.php.net/manual/en/ref.mbstring.php]mb_ functions[/url], if you can't use them, then you will need to create a simple convert function, using strtr(). If you can't setup the mb_ extension, then use...

[code]setlocale ( LC_CTYPE, 'el_GR' );

$str = strtoupper ( $str );

$str = strtolower ( $str );

$str = ucwords ( $str );[/code]


Where [b]'el_GR'[/b] is, it could also be just [b]'GR'[/b] or [b]'gr_GR'[/b] or just [b]'el'[/b], I say that because I have seen many different systems use each of these, so you have to test which one will work on the server you are running this on.


i've tried all cases. The first one (el_GR) will display Α������������������ Μ������������������������ Ο�������������� and all the other will display caps, as it is in the database...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.