适用于php的UTF-8解码 [英] UTF-8 Decode for php

查看:124
本文介绍了适用于php的UTF-8解码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从Tumblr API中获取帖子,并且遇到了与帖子"的返回正文"有关的编码问题.所有的撇号都替换为看起来像"aETM"的东西.

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".

我正在尝试使用:

utf8_decode($string)

但是所有要做的就是用?"代替出现的"aETM".

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

有什么建议吗?

推荐答案

尝试

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

这篇关于适用于php的UTF-8解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆