From cdeb9db91354232965885df9bd928be380d373ea Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 9 Oct 2009 17:51:31 +0000 Subject: [PATCH] fixed 'not well-formed...' error caused my ESP chararater passed to XMLin function git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4330 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Client.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index 5720d1f4b..b93e6c36b 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -161,7 +161,17 @@ sub submit_request { while (<$client>) { $response .= $_; if (m/<\/xcatresponse>/) { + #replace ESC with xxxxESCxxx because XMLin cannot handle it + $response =~ s/\e/xxxxESCxxxx/g; + $rsp = XMLin($response,SuppressEmpty=>undef,ForceArray=>1); + + #add ESC back + foreach my $key (keys %$rsp) { + if (ref($rsp->{$key}) eq 'ARRAY') { foreach my $text (@{$rsp->{$key}}) { $text =~ s/xxxxESCxxxx/\e/g; } } + else { $rsp->{$key} =~ s/xxxxESCxxxx/\r/g; } + } + $response=''; $callback->($rsp); if ($rsp->{serverdone}) {