handle responses with an encoding= (though not actually the encoding) master
authorivan <ivan>
Tue, 8 Nov 2011 22:34:10 +0000 (22:34 +0000)
committerivan <ivan>
Tue, 8 Nov 2011 22:34:10 +0000 (22:34 +0000)
Changes
lib/Net/Plesk.pm
lib/Net/Plesk/Response.pm

diff --git a/Changes b/Changes
index 86973c4..831f828 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history for Net::Plesk
 
+0.04  unreleased
+        - handle responses with an encoding= (though not actually the encoding)
+
 0.03  Fri Mar 14 14:16:04 2008 EDT
         - cite dependancies and other meta work
        - not really an Exporter and no need for Data::Dumper
index 92d42e7..23697ed 100644 (file)
@@ -21,7 +21,7 @@ use Net::Plesk::Method::client_ippool_add_ip;
 
 @ISA = ();
 
-$VERSION = '0.03';
+$VERSION = '0.04_01';
 
 $PROTO_VERSION = '1.4.1.0';
 
index 53342d5..6b9a46e 100644 (file)
@@ -37,9 +37,11 @@ sub new {
   my $self = {};
   bless($self, $class);
 
+  my $encoding = ''; #default
   my $data = shift;
-  if ($data =~ /^\<\?xml version=\"1.0\"\?\>(.*)$/s){
-    $data=$1;
+  if ($data =~ /^\<\?xml version=\"1.0\"(\s+encoding="([\w\-]*)")?\?\>(.*)$/s){
+    $encoding = $2; #don't actually do anything with this yet
+    $data = $3;
   }else{
     $data =~ s/[^\w\s]/ /g;  # yes, we lose stuff
     $data = '<?xml version="1.0"?>' .