fixed php char mapping

git-svn-id: https://svn.apache.org/repos/asf/qpid/proton/trunk@1403566 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/proton-c/bindings/php/proton.php b/proton-c/bindings/php/proton.php
index c90cd72..16025e1 100644
--- a/proton-c/bindings/php/proton.php
+++ b/proton-c/bindings/php/proton.php
@@ -211,10 +211,11 @@
     $props->clear();
     if ($this->properties != null)
       $props->put_object($this->properties);
-    if ($this->body != null)
+    if ($this->body != null) {
       // XXX: move this out when load/save are gone
       $body->clear();
       $body->put_object($this->body);
+    }
   }
 
   function _post_decode() {
@@ -510,6 +511,20 @@
 
 }
 
+class Char {
+
+  public $codepoint;
+
+  public function __construct($codepoint) {
+    $this->codepoint = $codepoint;
+  }
+
+  public function __tostring() {
+    return "Char($this->codepoint)";
+  }
+
+}
+
 class Described {
 
   public $descriptor;
@@ -690,7 +705,12 @@
   }
 
   public function put_char($c) {
-    $this->_check(pn_data_put_char($this->impl, ord($c)));
+    if ($c instanceof Char) {
+      $c = $c->codepoint;
+    } else {
+      $c = ord($c);
+    }
+    $this->_check(pn_data_put_char($this->impl, $c));
   }
 
   public function put_ulong($ul) {
@@ -804,7 +824,7 @@
   }
 
   public function get_char() {
-    return unichr(pn_data_get_char($this->impl));
+    return new Char(pn_data_get_char($this->impl));
   }
 
   public function get_ulong() {
@@ -1015,6 +1035,7 @@
      "Binary" => "put_binary",
      "Symbol" => "put_symbol",
      "integer" => "put_long",
+     "Char" => "put_char",
      "double" => "put_double",
      "Described" => "put_php_described",
      "PList" => "put_php_list",
diff --git a/proton-c/bindings/php/tests.php b/proton-c/bindings/php/tests.php
index 4c86f3c..8ae45cf 100644
--- a/proton-c/bindings/php/tests.php
+++ b/proton-c/bindings/php/tests.php
@@ -38,6 +38,7 @@
   $msg->properties["symbol"] = new Symbol("symbol");
   $msg->properties["uuid"] = new UUID("1234123412341234");
   $msg->properties["list"] = new PList(1, 2, 3, 4);
+  $msg->properties["char"] = new Char(321);
   $msg->body = $body;
   assert($msg->id == 10);
   assert($msg->correlation_id == "asdf");