2

The API response is displaying special characters instead of actual words (the actual words are from the tamil language)

What header should I add in this? Please provide some example.

Getting special like below:

கிழமை    

Function

function get_data($url) {
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}
demongolem
  • 9,474
  • 36
  • 90
  • 105
Bharanikumar
  • 25,457
  • 50
  • 131
  • 201
  • finally i fixed with below thread [http://stackoverflow.com/questions/1198701/storing-and-displaying-unicode-string-using-php-and-mysql][1] [1]: http://stackoverflow.com/questions/1198701/storing-and-displaying-unicode-string-using-php-and-mysql – Bharanikumar Apr 08 '13 at 05:27

1 Answers1

0

You may need to use Tamil charset. Check out the following link:

http://www.iam.uni-bonn.de/~alt/html/unicode_25.html

Use header like this:

$headers = array("Content-Type: application/x-www-form-urlencoded; charset: UTF-8");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 1);
Harpreet
  • 709
  • 5
  • 14
  • Thanks for your sugesstion, i have tried given snippet, but it is not worked as i expected, as well u have provided reference URL, i dont know how to apply that url mentioned 0B80 this code in CURL. please advise on this. – Bharanikumar Apr 05 '13 at 16:29
  • Try to use `charset: 0B80` in the above snippet. – Harpreet Apr 05 '13 at 16:32
  • $headers = array("Content-Type: application/x-www-form-urlencoded; charset:0B80"); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, 1); not worked, still same special characters – Bharanikumar Apr 05 '13 at 16:39