diff --git a/src/OffAmazonPaymentsService/Client.php b/src/OffAmazonPaymentsService/Client.php index c2e62c2..b5894ff 100644 --- a/src/OffAmazonPaymentsService/Client.php +++ b/src/OffAmazonPaymentsService/Client.php @@ -113,9 +113,19 @@ class OffAmazonPaymentsService_Client implements OffAmazonPaymentsService_Interf */ public function __construct($config = null) { - iconv_set_encoding('output_encoding', 'UTF-8'); - iconv_set_encoding('input_encoding', 'UTF-8'); - iconv_set_encoding('internal_encoding', 'UTF-8'); + if (!defined('PHP_VERSION_ID')) { + $version = explode('.', PHP_VERSION); + define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); + } + if (PHP_VERSION_ID >= 50600) + { + ini_set("default_charset", "UTF-8"); + } else { + iconv_set_encoding("internal_encoding", "UTF-8"); + iconv_set_encoding("input_encoding", "UTF-8"); + iconv_set_encoding("output_encoding", "UTF-8"); + } + $this->_merchantValues = OffAmazonPaymentsService_MerchantValuesBuilder::create($config)->build(); $this->_httpRequestFactory = new HttpRequestFactoryCurlImpl($this->_merchantValues); @@ -1835,4 +1845,4 @@ private function _convertReverseProviderCredit($request) return $parameters; } -} \ No newline at end of file +}