From: gggeek Date: Sun, 7 Jun 2015 14:36:58 +0000 (+0200) Subject: Add a test for receiving requests which use non-utf8 encoding X-Git-Tag: 4.0.0-alpha^2~18 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=5b7db050a80da5d250316e8fd8db2ed7960b8a16 Add a test for receiving requests which use non-utf8 encoding --- diff --git a/tests/3LocalhostTest.php b/tests/3LocalhostTest.php index 186dd59..ec9c561 100644 --- a/tests/3LocalhostTest.php +++ b/tests/3LocalhostTest.php @@ -186,6 +186,31 @@ class LocalhostTest extends PHPUnit_Framework_TestCase } } + public function testExoticCharsetsRequests() + { + // 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 = 'κόσμε'; // Greek word 'kosme'. NB: NOT a valid ISO8859 string! + $str = ' + + examples.stringecho + + + '.$sendString.' + + +'; + + // these calls will have no charset declaration in either http headers or xml prolog + $v = $this->send(mb_convert_encoding($str, 'UCS-4')); + $this->assertEquals($sendString, $v->scalarval()); + $v = $this->send(mb_convert_encoding($str, 'UTF-16')); + $this->assertEquals($sendString, $v->scalarval()); + } + /*public function testLatin1Method() { $f = new xmlrpcmsg("tests.iso88591methodname." . chr(224) . chr(252) . chr(232), array(