Reputation: 2318
I have source string (received from mail body)
=C7=E4=F0=E0=E2=F1=F2=E2=F3=E9=F2=E5
Online decoder says it Windows-1251 encoding and successfully convert it to UTF-8. mb_detect_encoding says it ASCII
I need to convert via PHP. I tried mb_convert_encoding and iconv, solution from stackoverflow (for example and one more) and many others. But there is no result. Source string is not changed.
Maybe you know working solution? Thank you.
Upvotes: 2
Views: 2816
Reputation: 41885
Yes you could try apply iconv()
in this case:
header('Content-Type: text/html; charset=utf-8');
$string = '=C7=E4=F0=E0=E2=F1=F2=E2=F3=E9=F2=E5';
$string = str_replace('=', '%', $string);
$string = rawurldecode($string);
$string = iconv('Windows-1251', 'UTF-8', $string);
echo $string; // Здравствуйте
Upvotes: 3