From e0f4e652619de64f3d16463a5f6ff053dafa1581 Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" <> Date: Tue, 6 Feb 2007 03:55:45 +0000 Subject: patch by Guzmán Brasó r=ghendricks, a=LpSolit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- importxml.pl | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'importxml.pl') diff --git a/importxml.pl b/importxml.pl index c19f6d96f..6dff2af7f 100755 --- a/importxml.pl +++ b/importxml.pl @@ -1178,16 +1178,22 @@ Debug( "Reading xml", DEBUG_LEVEL ); local ($/); $xml = <>; -# If the email was encoded (Mailer::MessageToMTA() does it when using UTF-8), -# we have to decode it first, else the XML parsing will fail. -my $parser = MIME::Parser->new; -$parser->output_to_core(1); -$parser->tmp_to_core(1); -my $entity = $parser->parse_data($xml); -my $bodyhandle = $entity->bodyhandle; -$xml = $bodyhandle->as_string; - -# remove everything in file before xml header (i.e. remove the mail header) +# If there's anything except whitespace before new; + $parser->output_to_core(1); + $parser->tmp_to_core(1); + my $entity = $parser->parse_data($xml); + my $bodyhandle = $entity->bodyhandle; + $xml = $bodyhandle->as_string; + +} + +# remove everything in file before xml header $xml =~ s/^.+(<\?xml version.+)$/$1/s; Debug( "Parsing tree", DEBUG_LEVEL ); -- cgit v1.2.3-24-g4f1b