dongyao1895 2017-08-04 20:49
浏览 49
已采纳

PHP的mb_strtoupper函数中的土耳其字符错误

My question is rather explanation for the Turkish colleges who have troubles with our funny characters.

It is for sure PHP 5 has a bug by capitalizing and also therefore collating them.

echo mb_strtoupper('Turkish capitals for ğ, i, ı, ş in uppercase', 'UTF-8');

gives the result: "TURKISH CAPITALS FOR Ğ, I, I, Ş IN UPPERCASE".

But it is wrong. The correct output should be "TURKİSH CAPİTALS FOR Ğ, İ, I, Ş İN UPPERCASE"

The problem in our language we have "i" in capitals "İ" and "ı" in capitals "I".

I guess you see the problem.

Whom shall we report this bug in PHP, does anybody know? Please inform and if you write a subroutine to solve this problem temporarily, it will be appreciated. Thanks ahead.

  • 写回答

3条回答 默认 最新

  • doujiang7258 2017-08-04 21:02
    关注

    Can you try this:

    function pre_up($str){
        $str = str_replace('i', 'İ', $str);
        $str = str_replace('ı', 'I', $str);
        return $str;
    }
    echo mb_strtoupper(pre_up('Turkish capitals for ğ, i, ı, ş in uppercase'), 'UTF-8');
    

    I don't know Turkish, is it correct?

    Output

    TURKİSH CAPİTALS FOR Ğ, İ, I, Ş İN UPPERCASE

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?