PHP preg_functions多字节安全吗? [英] Are the PHP preg_functions multibyte safe?
问题描述
PHP中没有多字节的"preg"函数,这是否意味着默认的preg_functions都是MB安全的?在php文档中找不到任何提及.
There are no multibyte 'preg' functions available in PHP, so does that mean the default preg_functions are all mb safe? Couldn't find any mention in the php documentation.
推荐答案
PCRE可以支持UTF-8和其他Unicode编码,但是必须在编译时指定.从
PCRE can support UTF-8 and other Unicode encodings, but it has to be specified at compile time. From the man page for PCRE 8.0:
PCRE的当前实现大致与Perl 5.10相对应,包括对UTF-8编码的字符串和Unicode常规类别属性的支持.但是,必须明确启用UTF-8和Unicode支持.它不是默认值. Unicode表对应于Unicode版本5.1.
The current implementation of PCRE corresponds approximately with Perl 5.10, including support for UTF-8 encoded strings and Unicode general category properties. However, UTF-8 and Unicode support has to be explicitly enabled; it is not the default. The Unicode tables correspond to Unicode release 5.1.
PHP当前使用 PCRE 7.9 ;您的系统可能具有较旧的版本.
PHP currently uses PCRE 7.9; your system might have an older version.
看看 PCR lib (随PHP 5.2一起提供)似乎已配置为支持Unicode属性和UTF-8.对于 5.3分支.
Taking a look at the PCRE lib that comes with PHP 5.2, it appears that it's configured to support Unicode properties and UTF-8. Same for the 5.3 branch.
这篇关于PHP preg_functions多字节安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!