mikaint Posted November 13, 2006 Share Posted November 13, 2006 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 More sharing options...
printf Posted November 13, 2006 Share Posted November 13, 2006 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. Link to comment https://forums.phpfreaks.com/topic/27081-convert-upper-to-lower-case/#findComment-123867 Share on other sites More sharing options...
mikaint Posted November 13, 2006 Author Share Posted November 13, 2006 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... Link to comment https://forums.phpfreaks.com/topic/27081-convert-upper-to-lower-case/#findComment-123922 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.