Okan Kocyigit
Okan Kocyigit

Reputation: 13421

strtolower function in php with windows-1254 charset

i have page and it has,

<meta http-equiv="Content-Type" content="text/html; charset=windows-1254">

when i try to change string with strtolower(). it is not working on "Ç,Ö,Ü,Ğ,Ş".

example,
$str= "ÇaTPÖ";
$str = strtolower($str);
//$str = "ÇatpÖ";

also i try to change them with ereg_replace(), but not working again.
$str = ereg_replace("Ç","ç",$str);
$str = ereg_replace("Ö","ö",$str);

so what's the problem do you think?

Upvotes: 3

Views: 779

Answers (2)

simshaun
simshaun

Reputation: 21466

PHP's built-in string manipulation functions are not multibyte-safe.

Check out the set of mb_* functions.

Edit: Also something of note: ereg is deprecated. Use preg instead.

Upvotes: 1

Floern
Floern

Reputation: 33904

Try mb_strtolower():

$str = mb_strtolower($str, 'windows-1254');

http://www.php.net/manual/en/function.mb-strtolower.php

Upvotes: 2

Related Questions