如何将ISO 8859-1字符转换为UTF-8 [英] how to convert ISO 8859-1 Characters to UTF-8

查看:158
本文介绍了如何将ISO 8859-1字符转换为UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CURL从另一个站点获取内容,但是我不知道为什么它会自动从UTF-8转换为ISO 8859-1,例如:

I use CURL to get content from another site, but i don't know why it's auto convert from UTF-8 to ISO 8859-1, like follow:

站点:abc.com:

site: abc.com:

CửaHàngChip Chip:RộnràngđónGiángsinhvớinhữngvậtphẩmtrangtríNoelđầymàusắccủaCHIPCHIP GIFT SHOP

Cửa Hàng Chip Chip: Rộn ràng đón Giáng sinh với những vật phẩm trang trí Noel đầy màu sắc của CHIPCHIP GIFT SHOP

但是当我使用CURL从该网站获取内容时,我得到了关注:

But when i use CURL get content from that site, i got follow:

Cửa Hàng Chip Chip: Rộn ràng đón Giáng sinh với những vật phẩm trang trí Noel đầy màu sắc của CHIPCHIP GIFT SHOP

那么如何将其转换为UTF-8?

So how to convert it's become to UTF-8 ?

推荐答案

您的文件未转换为其他编码.他们正在使用 HTML字符实体.您需要转换这些实体 ,例如é到UTF-8,例如é.如果您甚至需要执行此操作,则在转换为UTF-8之后,这需要多一行代码.

Your files aren’t being converted to another encoding. They’re using HTML character entities. You need to convert those entities, such as é to UTF-8, such as é. This takes one extra line of code after you convert to UTF-8, if you even need to do that.

这篇关于如何将ISO 8859-1字符转换为UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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