diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-09-10 08:59:45 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-09-10 08:59:45 +0000 |
commit | f93560ddc922a8e255084733f8d627cd3372f27e (patch) | |
tree | e517e6996468526599b501267f5f699b635458c8 /ext/soap/php_encoding.c | |
parent | ab52308356a0bb8c8456a6fb7d88546b9b62d053 (diff) | |
download | php-git-f93560ddc922a8e255084733f8d627cd3372f27e.tar.gz |
Using php_libxml_xmlCheckUTF8() from ext/libxml.
Diffstat (limited to 'ext/soap/php_encoding.c')
-rw-r--r-- | ext/soap/php_encoding.c | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index d107d7ff5d..72f6c73c8a 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -22,6 +22,7 @@ #include <time.h> #include "php_soap.h" +#include "ext/libxml/php_libxml.h" /* zval type decode */ static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data); @@ -581,32 +582,6 @@ static zval *to_zval_stringb(encodeTypePtr type, xmlNodePtr data) return ret; } -static int php_soap_xmlCheckUTF8(const unsigned char *s) -{ - int i; - unsigned char c; - - for (i = 0; (c = s[i++]);) { - if ((c & 0x80) == 0) { - } else if ((c & 0xe0) == 0xc0) { - if ((s[i++] & 0xc0) != 0x80) { - return 0; - } - } else if ((c & 0xf0) == 0xe0) { - if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) { - return 0; - } - } else if ((c & 0xf8) == 0xf0) { - if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) { - return 0; - } - } else { - return 0; - } - } - return 1; -} - static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNodePtr parent) { xmlNodePtr ret; @@ -638,12 +613,12 @@ static xmlNodePtr to_xml_string(encodeTypePtr type, zval *data, int style, xmlNo efree(str); str = estrdup(xmlBufferContent(out)); new_len = n; - } else if (!php_soap_xmlCheckUTF8(str)) { + } else if (!php_libxml_xmlCheckUTF8(str)) { soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str); } xmlBufferFree(out); xmlBufferFree(in); - } else if (!php_soap_xmlCheckUTF8(str)) { + } else if (!php_libxml_xmlCheckUTF8(str)) { soap_error1(E_ERROR, "Encoding: string '%s' is not a valid utf-8 string", str); } |