Thursday, 10 February 2011

UTF-8 encoding with nusoap

Again problems with UTF-8 encoding. This time it's related to nusoap. I hate when developers assume that everyone uses english by default. Everyone should use UTF-8 by default. But now to the point...

When submitting a request to nusoap-based web service (nusoap_server), it assumes that characters ar encoded using ISO-8859-1. In fact very first search made by Google with keywords "nusoap utf-8" showed me the right path, but since this is my notebook, i'm writing down to remember: When creating web service, you must tell nusoap to not decode utf8 since encoding is utf8 already (see code snippet below).

$server->configureWSDL('myWebServiceMethod', $namespace);
$server->wsdl->schemaTargetNamespace = $namespace;
$server->decode_utf8 = false;

No comments:

Post a Comment