nourdine
nourdine

Reputation: 7597

Encoding problem in PHP while making a webservice call

I have the nth problem encoding related with PHP!

so the story is:

I tried to force php to work with ISO-8859 by doing:

ini_set('default_charset', "ISO-8859");

The problem is that it still doesn't work and the webservice doesn't answer properly. I am sure that the webservice works as I tried to copy paste the url by hand in a browser and I received the expected data.

Upvotes: 1

Views: 891

Answers (1)

Pekka
Pekka

Reputation: 449515

You can convert data from one character set into another using iconv().

Your REST web service is most likely expecting UTF-8 data, so you would have to do something like this:

$data = iconv("iso-8859-1", "utf-8", $data);

before sending the request.

Upvotes: 1

Related Questions