summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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))