A
A
amiak2015-10-13 13:32:33
PHP
amiak, 2015-10-13 13:32:33

Why does CURL return shortcodes instead of unicode?

I send a curl request to the api point of the local site and instead of unicode I get a string like this

не работает чето

On the site everywhere is charset utf-8. There are no problems with displaying Unicode anywhere.
I also deal with the client application through api - I get unicode.
Looks like a problem with the curl.
Application in php 5.2.
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT,	 'anyMeta/OAuth 1.0 - ($LastChangedRevision: 174 $)');
curl_setopt($ch, CURLOPT_URL,  $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);

Update:
mb_detect_encoding('пацукен3') - returns UTF-8. How to make it readable?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MetaDone, 2015-10-13
@MetaDone

header('Content-Type: text/html; charset=utf-8');
do you have it written somewhere?
if not, then at the very beginning of the script loading, write down and try

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question