0

I am using curl to pull in a news feed, however the french version is pulling in some weird characters.

For example "activités" should be "activités"

$feed = curl_init($json);
$options = array(
   CURLOPT_RETURNTRANSFER => true,
   CURLOPT_HTTPHEADER => array('Content-type: application/json'),
   CURLOPT_POSTFIELDS => $feed
);
curl_setopt_array($feed, $options);
$news = curl_exec($feed);
curl_close($feed);

$articles = json_decode($news, true);
green_arrow
  • 1,257
  • 7
  • 21
  • 37
  • [What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text](http://kunststube.net/encoding/), [Handling Unicode Front To Back In A Web App](http://kunststube.net/frontback/) – deceze Aug 15 '13 at 10:24
  • You need to get your encoding handling in line. The browser is interpreting the content in the wrong encoding, plain and simple. Read all the above. – deceze Aug 15 '13 at 10:26
  • @deceze, you could have mentioned. check my profile instead of putting up all those links. – Shankar Narayana Damodaran Aug 15 '13 at 10:27
  • @Shankar The advantage of which is...? – deceze Aug 15 '13 at 10:29

1 Answers1

-1

Have you tried to set the correct charset, i.e. CURLOPT_HTTPHEADER => array('Content-type: application/json', 'charset=utf-8')

This could probably solve your problem.

Doppelmoep
  • 436
  • 5
  • 19