dongzheng7165 2013-02-08 16:25
浏览 45
已采纳

如何将日语英语字符转换为普通英语字符?

I have an japanese english character. This character is not normal english string.

Characters: Game

How to transform this character to normal english character in php?

  • 写回答

2条回答 默认 最新

  • dongzhi9192 2013-02-08 16:51
    关注

    Subtract 65248 from the ordinal value of each character. In other words:

    $str = "Game some other text by ヴィックサ";
    $str = preg_replace_callback(
        "/[\x{ff01}-\x{ff5e}]/u",
        function($c) {
            // convert UTF-8 sequence to ordinal value
            $code = ((ord($c[0][0])&0xf)<<12)|((ord($c[0][1])&0x3f)<<6)|(ord($c[0][2])&0x3f);
            return chr($code-0xffe0);
        },
        $str);
    

    This will replace all of the "Fullwidth" characters with their normal width equivalents.

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

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测