X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2F3LocalhostTest.php;h=0290dbf97eab1bbc4fe91bf27fbcf3d979df059e;hb=640b8c0e60bb8a13dde241ec4d23ca1f58bb5b8a;hp=d81c0d0ae10d3fb63dbcb2eb61d45df863e8e177;hpb=cfa2ba8c5cb4c3cd219beb5ff3297099d7bd8fda;p=plcapi.git diff --git a/tests/3LocalhostTest.php b/tests/3LocalhostTest.php index d81c0d0..0290dbf 100644 --- a/tests/3LocalhostTest.php +++ b/tests/3LocalhostTest.php @@ -206,13 +206,64 @@ class LocalhostTest extends PHPUnit_Framework_TestCase PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; // we have to set the encoding declaration either in the http header or xml prolog, as mb_detect_encoding - // (used on the server side) will fail recognizing these 2 + // (used on the server side) will fail recognizing these 2 charsets $v = $this->send(mb_convert_encoding(str_replace('_ENC_', 'UCS-4', $str), 'UCS-4', 'UTF-8')); $this->assertEquals($sendString, $v->scalarval()); $v = $this->send(mb_convert_encoding(str_replace('_ENC_', 'UTF-16', $str), 'UTF-16', 'UTF-8')); $this->assertEquals($sendString, $v->scalarval()); PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'ISO-8859-1'; + } + public function testExoticCharsetsRequests2() + { + // note that we should disable this call also when mbstring is missing server-side + if (!function_exists('mb_convert_encoding')) { + $this->markTestSkipped('Miss mbstring extension to test exotic charsets'); + return; + } + $sendString = '安室奈美恵'; // No idea what this means :-) NB: NOT a valid ISO8859 string! + $str = ' + + examples.stringecho + + + '.$sendString.' + + +'; + + PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; + // no encoding declaration either in the http header or xml prolog, let mb_detect_encoding + // (used on the server side) sort it out + $this->client->path = $this->args['URI'].'?DETECT_ENCODINGS[]=EUC-JP&DETECT_ENCODINGS[]=UTF-8'; + $v = $this->send(mb_convert_encoding($str, 'EUC-JP', 'UTF-8')); + $this->assertEquals($sendString, $v->scalarval()); + PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'ISO-8859-1'; + } + + public function testExoticCharsetsRequests3() + { + // note that we should disable this call also when mbstring is missing server-side + if (!function_exists('mb_convert_encoding')) { + $this->markTestSkipped('Miss mbstring extension to test exotic charsets'); + return; + } + $sendString = utf8_decode('élève'); + $str = ' + + examples.stringecho + + + '.$sendString.' + + +'; + + // no encoding declaration either in the http header or xml prolog, let mb_detect_encoding + // (used on the server side) sort it out + $this->client->path = $this->args['URI'].'?DETECT_ENCODINGS[]=ISO-8859-1&DETECT_ENCODINGS[]=UTF-8'; + $v = $this->send($str); + $this->assertEquals($sendString, $v->scalarval()); } /*public function testLatin1Method()