From 5d5f2586ff5a9ca8d194af830f93d4c251a7368d Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" Date: Mon, 5 Feb 2007 19:55:45 +0000 Subject: [PATCH] =?UTF-8?q?patch=20by=20Guzm=EF=BF=BD=EF=BF=BDn=20Bras?= =?UTF-8?q?=EF=BF=BD=EF=BF=BD=20r=3Dghendricks,=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webtools/bugzilla/importxml.pl | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/webtools/bugzilla/importxml.pl b/webtools/bugzilla/importxml.pl index c19f6d96fa6..6dff2af7f0a 100755 --- a/webtools/bugzilla/importxml.pl +++ b/webtools/bugzilla/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; +# 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 );