cvs: pear /Services_Ebay/Ebay Session.php
| From: | Stephan Schmidt | Date: | Thu, 23 Dec 2004 18:56:36 +0000 |
| Subject: | cvs: pear /Services_Ebay/Ebay Session.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-27797@lists.php.net to get a copy of this message | ||
schst Thu Dec 23 13:56:36 2004 EDT
Modified files:
/pear/Services_Ebay/Ebay Session.php
Log:
make UTF-8 encoding optional, as sandbox does not yet support this
http://cvs.php.net/diff.php/pear/Services_Ebay/Ebay/Session.php?r1=1.10&r2=1.11&ty=u
Index: pear/Services_Ebay/Ebay/Session.php
diff -u pear/Services_Ebay/Ebay/Session.php:1.10 pear/Services_Ebay/Ebay/Session.php:1.11
--- pear/Services_Ebay/Ebay/Session.php:1.10 Thu Dec 23 05:26:13 2004
+++ pear/Services_Ebay/Ebay/Session.php Thu Dec 23 13:56:35 2004
@@ -16,7 +16,7 @@
// | Authors: Stephan Schmidt <schst@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Session.php,v 1.10 2004/12/23 10:26:13 schst Exp $
+// $Id: Session.php,v 1.11 2004/12/23 18:56:35 schst Exp $
/**
* Services/Ebay/Session.php
@@ -185,15 +185,18 @@
* @var array
*/
private $serializerOptions = array();
-
+
/**
* create the session object
*
* @param string developer id
* @param string application id
* @param string certificate id
+ * @param string encoding to use: in production environments you should use UTF-8, when
+ * working with the sandbox, use ISO-8859-1 as the sabdbox
+ * does not (yet) support UTF-8 encoding
*/
- public function __construct($devId, $appId, $certId)
+ public function __construct($devId, $appId, $certId, $encoding = 'ISO-8859-1')
{
$this->devId = $devId;
$this->appId = $appId;
@@ -205,22 +208,27 @@
'linebreak' => "\n",
'typeHints' => false,
'addDecl' => true,
- 'encoding' => 'UTF-8',
+ 'encoding' => $encoding,
'scalarAsAttributes' => false,
'rootName' => 'request',
'rootAttributes' => array( 'xmlns' =>
'urn:eBayAPIschema' ),
- 'encodeFunction' => 'utf8_encode'
);
- $this->ser = new XML_Serializer( $opts );
+
+ // UTF-8 encode the document
+ if ($encoding === 'UTF-8') {
+ $options['encodeFunction'] = 'utf8_encode';
+ }
+
+ $this->ser = new XML_Serializer($opts);
$opts = array(
'forceEnum' => array('Error'),
'encoding' => 'UTF-8',
'targetEncoding' => 'ISO-8859-1'
);
- $this->us = new XML_Unserializer( $opts );
+ $this->us = new XML_Unserializer($opts);
}
-
+
/**
* set the debug mode
*