NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Nusoap with UTF-8


Joined: 10 Jun 2008
Posts: 4
Reply with quote
Hi all,

I would like to force nusoap to work with UTF-8.
It seems to only work with ISO-8859-1 but I absolutly need UTF-8.

How can I configure nusoap to return UTF-8 ?

Thanks in advance for any help
View user's profileFind all posts by timor.superSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8328
Reply with quote
NuSoap supports three encodings: ISO-8859-1, US-ASCII, and UTF-8.
Did you try to set $soap_defencoding property?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Jun 2008
Posts: 4
Reply with quote
Thanks for your answer.

This is what i've done :

in my webservice.php :
Code:

$server = new soap_server();
$server->soap_defencoding = 'UTF-8';
$server->register(...);
...


I've modified the file nusoap.php, comment the line
Code:
//var $soap_defencoding = 'ISO-8859-1';

uncomment the line
Code:
var $soap_defencoding = 'UTF-8';


the same thing has be done in the file class.nusoap_base.php

When i call the file : webservice.php?wsdl
I've :

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:hellowsdl2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:hellowsdl2">
<types>
....


To register the ws, i'm setting the document style and the literal use.

What am I doing wrong ?

Thanks for your help
View user's profileFind all posts by timor.superSend private message


Joined: 10 Jun 2008
Posts: 4
Reply with quote
this is not possible ? Crying or Very sad
View user's profileFind all posts by timor.superSend private message
xmmm


Joined: 07 Jul 2008
Posts: 1
Reply with quote
try this

$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
View user's profileFind all posts by nsyllSend private message
utf-8 my solution


Joined: 08 Sep 2009
Posts: 1
Location: Israel
Reply with quote
I was using a vb2008-express to test connection with my php webservice.

text that i sent to from the desktop vb program was returned from the webservice to the desktop application.

but, hebrew came back as ??????.

what solve the problem (after converting all ISO-8859-1 to UTF-8, and in the vb sending the string after .normalize() ), is that I submitted the post_data like that:
$server->service(utf8_encode($POST_DATA));

that did the trick.
View user's profileFind all posts by yarivSend private message


Joined: 21 Dec 2011
Posts: 1
Reply with quote
In the file nusoap.php, around line 5480, you should change:

FROM: $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';

TO: $xml = '<?xml version="1.0" encoding="UTF-8"?>';

After that, your webservice will be like this <?xml version="1.0" encoding="UTF-8" ?>
View user's profileFind all posts by moura.nySend private message
Re: xmmm


Joined: 05 Dec 2013
Posts: 1
Reply with quote
nsyll wrote:
try this

$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;


Hello,

i'm having about the same problem here and this did not work for me. Do you have any other ideas ?

thanks
View user's profileFind all posts by meli70Send private message


Joined: 13 Apr 2015
Posts: 1
Reply with quote
this is not possible ? Crying or Very sad....

_________________
GuL
View user's profileFind all posts by sakooonSend private message


Joined: 13 Dec 2012
Posts: 2
Reply with quote
Set the 'decode_utf8' for the server too.

Code:
$server->soap_defencoding = 'UTF-8';
$server->decode_utf8 = false;
View user's profileFind all posts by grossmanSend private message
Nusoap with UTF-8
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic