Forum Moderators: coopster

Message Too Old, No Replies

strtolower problem with some languages

         

carsten888

12:14 pm on Dec 3, 2010 (gmt 0)

10+ Year Member



I'm trying to make a language string lowercase. strtolower works fine for most languages, but for some language this just returns ? (bunch of questionmarks, which are filtered out of this post).

<?php

echo strtolower('Hello');

?>

output:

hello



The file is correctly saved in utf-8 and the html-header is also in utf-8.

<?php

echo 'Strange language string (which this forum can not display)';

?>

outputs correctly.

So the problem is that when trying to make a string lowercase, in some languages the output becomes a bunch of questionmarks.

Is there a workaround to make the strings lowercase only for languages which support this?

JuicyScript

12:36 pm on Dec 3, 2010 (gmt 0)

10+ Year Member



Probably you could check some documentations of that language before using that code.Most languages have their way of writing these codes.

coopster

1:37 pm on Dec 3, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have you considered the multibyte function [php.net] instead?

carsten888

3:55 pm on Dec 3, 2010 (gmt 0)

10+ Year Member



@coopster
Yeah! thank you loads! livesaver.


$str = mb_strtolower($str, 'UTF-8');