UTF-8 Decode for php

一世执手 提交于 2019-12-09 23:05:52

问题


I am fetching posts from the Tumblr API and am running into an encoding issue with the returned "body" of the "post". All apostrophes are replaced by something that looks like "aETM".

I am trying to use:

utf8_decode($string)

But all that does is replace the occurrences of "aETM" with a "?".

Any suggestions?


回答1:


try

$string = mb_convert_encoding($string,'HTML-ENTITIES','utf-8');



回答2:


Use this link to convert string

iconv("UTF-8", "CP1252", $data)



来源:https://stackoverflow.com/questions/11768839/utf-8-decode-for-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!