katpatuka’s sources

thoughts and lost and founds

php5.x türkçe bug (tr_TR locale)

Posted by katpatuka on 5. September 2007

Türklere ayıp eden büyük bir PHP5 bug var. Locale, tr_TR ayarlandığında fonksiyon ve değişken adlarında I (büyük ı) bulunuyorsa script hata veriyor ve çalışmaz hale geçiyor; ama I kullanmazsanız problem yok. Aşağıda ki kod doğru çalışmıyor PHP5′te (<= 5.2.0 ?):

<HTML>
<HEAD>
  <META HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF8">
  <META HTTP-EQUIV="content-language" CONTENT="tr">
  <TITLE>php5 tr_TR.UTF8 bug</TITLE>
</HEAD><BODY>
<?
class foo
{
    function hereIsIt()
    {
        echo "HereItIs çalışmaz... ";
    }
}
class bar
{
    function hereNot()
    {
        echo "hereNot çalışıyor... ";
    }
}
setlocale(LC_ALL, 'tr_TR.UTF8');
$g = new bar();
$f = new foo();
$g->hereNot();
$f->hereIsIt();
?>
</BODY>
</HTML>

Neden düzenlenemez ?

Sonuç: Status: Wont fix

We discussed it and this will not be addressed in PHP 5, but only from
PHP 6 and higher.

Yani:

Tartıştık ve PHP5′de değiştirilmiyecek; PHP6′da düzenlenek

Aferin PHP! Çok ayıp! PHP6 ne zaman çıkacak acaba? Onu şimdi beklemek zorunda mıyım?
Onun için Türk hosting şirketlerinin halen PHP4.4 kullanması gerektiriyor ve onun desteği 2007 sonunda bitecek!

2 Responses to “php5.x türkçe bug (tr_TR locale)”

  1. katpatuka said

    Yukarıda ki bug için bir patch yayınlandı, fakat o da benim
    sisteminde ki PHP5.2.0 olmadı. Bu patch herhalde PHP5.2.1′den itibaren çalışabilir:

    Patch is written for PHP 5.2.5-dev. It should work in 6.0-dev and PHP
    5.2.1 or later version. Any version later than 2006-12-05.

    Fakat bir workaround var… o yarayabilir:

    If you need workaround, just set LC_CTYPE locale to C. It also deals with
    programming mistakes in PHP scripts.

    setlocale(LC_ALL,’tr_TR.UTF-8′);
    setlocale(LC_CTYPE, ‘C’);

  2. kemal said

    5.2 de varmıydı bilmiyorum ama şuan 5.3 versiyonunu kullanıyorum. Verdiğiniz kodu çalıştırdım bende sorun yok şuan gayet düzgün görünüyor dediğin karakter.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>