I am getting the XML from a SOAP web service and it is encoded as
UTF-16. I asked the service provider if there was a way to change the
encoding and they said no. So that means I have to change the
encoding before I load it or us some other way of handling the XML.
SimpleXMLElement() errors with encoding is UTF-16 not UTF-8
otherwise.
On Jun 24, 5:38 pm, Robert Gonzalez
> On Fri, Jun 24, 2011 at 3:31 PM, James Blackburn <
jimboid...@gmail.com>wrote:
>
>
>
> > Hi Robert.
>
> > I just looked up asXML and it looks like this is called after
> > SimpleXMLElement() and is failing.
> > $retval = $cc->CheckAvailability($uid);
> > if I don't do the str_replace() then the next line errors.
> > $cxml = str_replace('UTF-16',
> > 'UTF-8',$retval->CheckAvailabilityResult);
> > $xml = new SimpleXMLElement($cxml);
>
> > On Fri, Jun 24, 2011 at 4:03 PM, Robert Gonzalez <
> >
robert.anthony.gonza...@gmail.com> wrote:
>
> >> Its a dirty hack, but you could always call the asXML method then take the
> >> full xml string and replace the first '>' with ' encoding="utf-16">'.
>
> >> Like I said, dirty.
>