Nusoap response xml utf-8 content showing like ? eventhough i added soap_defencoding = 'UTF-8' and decode_utf8 = false in client and server

StackOverflow https://stackoverflow.com/questions/22858775

Question

Nusoap response xml utf-8 content showing like ? eventhough i added soap_defencoding = 'UTF-8' and decode_utf8 = false in client and server file and i've also added utf8_decode in result array in server php file.

server.php

<?php

require_once("lib/nusoap.php");

$server = new nusoap_server;
$server->configureWSDL("searchwsdl", "searchwsdl#search");


//$server->xml_encoding ="utf-8";
$server->soap_defencoding = 'UTF-8';
$server->decode_utf8 = false;

/*
$server->decode_utf8 = false;
$server->encode_utf8 = true;*/

$server->wsdl->addComplexType(
        "searchdata",
        "complexType",
        "struct",
        "all",
        "",
        array(
            "searchkey" => array("name"=>"searchkey", "type"=>"xsd:string")
        )
    );



$server->register(
        'searchstring',
        array(
            "searchstr"=>"tns:searchdata"
        ),
        array(
            "return"=>"xsd:Array"
        ),
        'uri:searchwsdl',
        'uri:searchwsdl#search',
        'rpc',
        'encoded'
    );


function searchstring($searchstr){
   return resultArray;

}
?>

client.php

<?php

 $searchClient = new nusoap_client($url);
                               $searchClient->soap_defencoding = 'UTF-8';
                                $searchClient->decode_utf8 = false;


                             if($searchClient->getError()){
                                echo $searchClient->error_str;
                             }else{ 

                                     $results = $searchClient->call("searchstring", array("searchKey"=>$searchKey), "uri:searchwsdl", "uri:searchwsdl#search");

                        //echo $searchClient->error_str;
                        //echo $searchClient->faultdetail;
                        //echo utf8_decode($searchClient->response);

                                 if($searchClient->getError()){
                                         $searchClient->error_str;
                                 }else{
                                    if($searchClient->fault){
                                        echo $searchClient->faultdetail;
                                    }else{



                                     print_r($results);

?>

contnet-type for Both response and request xml are in UTF-8, but still utf characters are showing in question mark (?).

Was it helpful?

Solution

i was fixed the above issue. i forgot to change mysql charset.

<?php

mysqli_set_charset("utf8")

?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top