summaryrefslogtreecommitdiff
path: root/it_xml.class
diff options
context:
space:
mode:
authorChristian Schneider2009-10-27 15:26:45 +0000
committerChristian Schneider2009-10-27 15:26:45 +0000
commit812a0ec935ce5b05b44621beb2f0e2959b4da224 (patch)
treeac18d3be548a6b73ee11cd302eaf747bc3b8df7b /it_xml.class
parent90af8efd7ca2789cf8dddcd76cea8d4c88dc7770 (diff)
downloaditools-812a0ec935ce5b05b44621beb2f0e2959b4da224.tar.gz
itools-812a0ec935ce5b05b44621beb2f0e2959b4da224.tar.bz2
itools-812a0ec935ce5b05b44621beb2f0e2959b4da224.zip
Only ltrim at beginning of xml file when sanitizing (fixes streaming mode)
Diffstat (limited to 'it_xml.class')
-rw-r--r--it_xml.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it_xml.class b/it_xml.class
index 29652d8..257074c 100644
--- a/it_xml.class
+++ b/it_xml.class
@@ -114,10 +114,10 @@ function from_xml($xmldata, $p)
# Use various heuristics to fix real-world XML files
function _sanitize($xmldata, $isutf8 = null)
{
- $xmldata = trim($xmldata);
-
if (!isset($isutf8)) # Check if we already decided on charset yet
{
+ $xmldata = ltrim($xmldata);
+
# Add header for charset detection (PHP5) if no header/BOM
# See http://www.w3.org/TR/2006/REC-xml-20060816/#sec-guessing
if (!preg_match('/^(<\?xml|\xEF\xBB\xBF|\xFE\xFF|\xFF\xFE|\x00\x00\xFE\xFF|\x00\x00\xFF\xFE)/', $xmldata))