Problem encoding characters from Facebook JSON to HTML via PHP

I get a JSON encoded array from Facebook that contains:

[{"message": "D \ u011bkujeme Zuzana Boh \ u010dov \ u00e1 za na \ u0161i novou profilovou fotku: -) \ nWe thank Zuzana Boch \ u010dov \ u00e1 for our new profile :-)"}]

When I decode JSON and print the content I get:

DÄ> kujeme Zuzana BohÃÄÄÃÃÃà ¢ za naái novou profilovou fotku :-) We thank Zuzana BohÃÃÄÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃà ¢ for our new image :-)

I used mb_detect_encoding($message)utf-8 as well, but how do I convert characters ready for human consumption?

+3
source share
2

, .

, . PHP :

ini_set( 'default_charset', 'UTF-8' );

header( 'Content-Type: text/html; charset=utf-8' );
+3

PHP . , , - , :

header('Content-type: text/html; charset=utf-8');
+3

Source: https://habr.com/ru/post/1752474/


All Articles