Reputation: 4306
I'm fetching the contents of a Windows-1251 encoded web site using file_get_html and want to serve it as UTF-8.
I set the headers to UTF-8 using: header('Content-type: text/html; charset=UTF-8');
Then i output the data using iconv("cp1252","UTF-8",'"desc":"'.$desc);
The output is no longer strange questions marks, but it's still not Cyrillic.
Upvotes: 4
Views: 10139
Reputation: 3683
Try not prepending anything to your string, letting it be just
iconv("cp1252","UTF-8",$desc);
By the way, do you get the cyrillic output if you just do
header('Content-Type: text/html; charset=cp1252');
echo $desc; // No iconv
Upvotes: 3