summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2010-04-14 16:26:15 +0000
committerUrban Müller2010-04-14 16:26:15 +0000
commit7856adae233d2ddf2aed7d8f4a8c41069ec13006 (patch)
tree5c8e90dc4bed4849c8330677f98060a9a6790be4
parent8ace003be8ca4e1892f76f48eba3d1c5df22ed20 (diff)
downloaditools-7856adae233d2ddf2aed7d8f4a8c41069ec13006.tar.gz
itools-7856adae233d2ddf2aed7d8f4a8c41069ec13006.tar.bz2
itools-7856adae233d2ddf2aed7d8f4a8c41069ec13006.zip
faster, commented
-rw-r--r--it_xml.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_xml.class b/it_xml.class
index a861245..da02b00 100644
--- a/it_xml.class
+++ b/it_xml.class
@@ -133,7 +133,8 @@ function _sanitize($xmldata, $isutf8 = null)
if ($isutf8 && preg_match('/[^\x80-\xff][\x80-\xff][^\x80-\xff]/', $xmldata))
$xmldata = preg_replace('/[\x80-\xff]{1,4}/e', "it_xml::_utf8_fix('\\0')", $xmldata);
- if (!$isutf8)
+ # If not utf-8, remove characters illegal for latin-1
+ if (!$isutf8 && preg_match('/[\x00-\x08\x0a-\x0c\x0e-\x1f\x80-\x9f]/', $xmldata))
$xmldata = it_html::latinize($xmldata);
return array($xmldata, $isutf8);