PHP将Windows-1251转换为UTF 8 [英] PHP Convert Windows-1251 to UTF 8

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

问题描述

我有一个小的HTML代码,我需要将其转换为UTF-8。

我使用这个 iconv(windows-1251,utf-8 ,$ html);

I have a small html code and I need to convert it to UTF-8.
I use this iconv("windows-1251", "utf-8", $html);

所有文本都正确转换,但如果文本例如在标签< i> ..< / i> ,那么它不会转换文本,我看到了像这样ПоказаС,СЊРјРЅ

All text converts correctly, but if text for example in tag <i>...</i>, then it don't convert text and I see somethig like this Показать мн

推荐答案

如果您有权访问Multibye软件包,可以试试。请在这里查看PHP页面:
http://www.php.net/ manual / en / function.mb-convert-encoding.php

If you have access to the Multibye package, you can try it. See the PHP page here: http://www.php.net/manual/en/function.mb-convert-encoding.php

$html_utf8 = mb_convert_encoding($html, "utf-8", "windows-1251");

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

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