0

I'm doing a curl request and I'm getting this reply:-

Expected : "£12709"

Got : "£12709"

I have no clue what "Â" this character is.

m1alesis
  • 670
  • 6
  • 16
  • Do you get that when sending a request outside of PHP? I'm assuming youre not using utf-8. Try `curl_setopt($ch, CURLOPT_ENCODING ,"");` – Devon Bessemer Apr 27 '15 at 23:29
  • Hi, im not sending request outside php. Just tried your solution and still no luck :( – m1alesis Apr 27 '15 at 23:31
  • 1
    This is probably UTF-8 data wrongly being interpreted as ISO-8859-1. You could use [`utf8_decode`](http://php.net/manual/en/function.utf8-decode.php) to decode it properly. – Frxstrem Apr 27 '15 at 23:32
  • Two other SO questions on this here: http://stackoverflow.com/questions/10761411/php-curl-utf-8-charset and here: http://stackoverflow.com/questions/649480/curl-import-character-encoding-problem – John McMahon Apr 27 '15 at 23:33
  • Maybe check the encoding and convert it like here http://stackoverflow.com/questions/649480/curl-import-character-encoding-problem – maalls Apr 27 '15 at 23:35
  • Hi, Thanks that link helped me, all I did was included header('Content-type: text/html; charset=UTF-8'); on the top of my php and now I dont get the extra character. – m1alesis Apr 27 '15 at 23:35
  • @JohnMcMahon if you put that comment as answer I will accept it. – m1alesis Apr 27 '15 at 23:38

1 Answers1

0

I found these two similar SO posts that may be helpful:

PHP Curl UTF-8 Charset

CURL import character encoding problem

Community
  • 1
  • 1
John McMahon
  • 1,605
  • 1
  • 16
  • 21