【发布时间】:2011-07-13 19:58:55
【问题描述】:
例如:
<!-- All the characters are going to be converted into a Hex values depending the encoding used -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- It Just interpret the Hex values that are going to be displayed -->
<?php
/* PHP Strings are bytestream */
/* PHP treat the strings as a Hex values from the econding used */
$string="€"; // Hex value from the Encoding Method(UTF-8). [U+20AC][E2|82|AC]
if(preg_match('/\xE2\x82\xAC/',$string,$m)){
echo "Match<br>";
print_r($m);
}
else{
echo "Don't Match";
}
?>
只要您使用正确的字节序列来匹配 Unicode 字符。 不需要使用Unicode Support吗?
还是我想错了?
【问题讨论】:
标签: php regex unicode utf-8 pcre