issue 2247 , Remove non utf-8 and user defined area codes

git-svn-id: http://xe-core.googlecode.com/svn/branches/luminous@11212 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-09-12 05:09:28 +00:00
parent d0f36fe5d6
commit b5f5c6f094

View file

@ -164,20 +164,7 @@ class Argument {
*/
function _escapeStringValue($value) {
// Remove non-utf8 chars.
$regex = <<<'END'
/
(
(?:
[\x00-\x7F] # single-byte sequences 0xxxxxxx
|[\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx 10xxxxxx
|[\xE0-\xEF][\x80-\xBF]{2} # triple-byte sequences 1110xxxx 10xxxxxx * 2
)+
)
|([\xF0-\xF7][\x80-\xBF]{3}) # quadruple-byte sequence 11110xxx 10xxxxxx * 3
|([\x80-\xBF]) # invalid byte in range 10000000 - 10111111
|([\xC0-\xFF]) # invalid byte in range 11000000 - 11111111
/x
END;
$regex = '@((?:[\x00-\x7F]|[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2})+)|([\xF0-\xF7][\x80-\xBF]{3})|([\x80-\xBF])|([\xC0-\xFF])@x';
$value = preg_replace_callback($regex, array($this, 'utf8Replacer'), $value);
$db = &DB::getInstance();