php file_get_contents().. doesn't handle special characters?
I've got an HTML file with special characters such as:
AT&T™ Official Site
When I use file_get_contents() on开发者_Python百科 the file and echo the contents, I get something like this:
AT&T\u00e2\u0084\u00a2 Official Site
How can I convert the latter to the former?
This is all I'm running:
echo file_get_contents("http://www.google.com/uds/GafsAds?q=att&hl=en&ad=w1&source=gcsc&qid=127c30648069871ea");
file_get_contents() doesn't parse or decode the content of the file in any way. It only returns you the bytes the file contains as-is (PHP strings are actually strings of bytes, not characters). This encoding is taking place somewhere else.
Look into Unicode.
Maybe utf8_decode() can help ? (not sure)
精彩评论