PHP curl hit special characters -
the api response displaying special characters instead of actual words (the actual words tamil language)
what header should add in this? please provide example.
getting special 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; }
you may need use tamil charset. check out following link:
http://www.iam.uni-bonn.de/~alt/html/unicode_25.html
use header 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);
Comments
Post a Comment