【发布时间】:2011-10-05 17:30:10
【问题描述】:
假设我用 UTF-8 编码我的文件。
在 PHP 脚本中,将比较一个字符串:
$string="ぁ";
$string = utf8_encode($string); //Do i need this step?
if(preg_match('/ぁ/u',$string))
//Do if match...
没有 utf8_encode() 函数的 string 真的是 UTF-8 吗? 如果你用 UTF-8 编码你的文件不需要这个功能?
【问题讨论】:
-
是的,但是如果我用 UTF-8 编码我的文件仍然是必要的?我的意思是它们是用 UTF-8 编码的,为什么要再次编码?
标签: php regex utf-8 character-encoding