I have a web service built using the Zend Framework. One of the methods is intended to send details about an order. I ran into some encoding issue. One of the values being returned contains the following:
productname™
The webservice is returning the following fault:
SOAP-ERROR: Encoding: string 'productname\xc3...' is not a valid utf-8 string
Solution ::::
the code which caused that problem was:
$value['name'] = substr($_product->getName(), 0, 40);
changing substr to mb_substr seems to solve the issue:
$value['name'] = mb_substr($_product->getName(), 0, 40, 'utf8');
productname™
The webservice is returning the following fault:
SOAP-ERROR: Encoding: string 'productname\xc3...' is not a valid utf-8 string
Solution ::::
the code which caused that problem was:
$value['name'] = substr($_product->getName(), 0, 40);
changing substr to mb_substr seems to solve the issue:
$value['name'] = mb_substr($_product->getName(), 0, 40, 'utf8');
Comments
Post a Comment