diff options
author | Christian Schneider | 2009-10-27 15:26:45 +0000 |
---|---|---|
committer | Christian Schneider | 2009-10-27 15:26:45 +0000 |
commit | 812a0ec935ce5b05b44621beb2f0e2959b4da224 (patch) | |
tree | ac18d3be548a6b73ee11cd302eaf747bc3b8df7b | |
parent | 90af8efd7ca2789cf8dddcd76cea8d4c88dc7770 (diff) | |
download | itools-812a0ec935ce5b05b44621beb2f0e2959b4da224.tar.gz itools-812a0ec935ce5b05b44621beb2f0e2959b4da224.tar.bz2 itools-812a0ec935ce5b05b44621beb2f0e2959b4da224.zip |
Only ltrim at beginning of xml file when sanitizing (fixes streaming mode)
-rw-r--r-- | it_xml.class | 4 |
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)) |