处理 HTML 字符编码问题
-认为这称为字符编码,但如果我错了,请重新命名-
问题:尝试使用 phpquery 使用 HTML 并在运行后保持 html 的完整性php 查询函数。
这些是 HTML 在运行函数时所做的更改:
原始 HTML:
快速& Strong I Concrete
HTML 页面转换为 PHPQueryObject:
快速&强IÂ 具体
PHPQueryObject 通过 Find() 函数运行:
快速& Strong I·Concrete
尝试了htmlentities()
、html_entity_decode()
、iconv()
的各种组合来处理移动数据并保持原始结构,而不显示一堆不必要的字符。我认为这是 phpquery 使用 html 的能力的限制,所以我需要解决方法。
我已经通过使用 iconv("UTF-8", "BIG5//IGNORE") 成功删除了 Â 和其他不需要的字符,但它对原始 html 有一定的破坏性,因为它是用于传统的汉字。
问题:什么是Â
和
以及我如何处理它们以便上面使用的html#2和#3按上面#1 的原意显示而不向浏览器显示额外的字符?
-Think this is called character encoding but please re-title if I'm wrong-
Issue: Trying to consume HTML with phpquery and maintain the html's integrity after it runs through the phpquery functions.
These are the changes to the HTML as it runs through the functions:
Original HTML:
<strong> Fast & Strong I Concrete</strong>
HTML Page Converted to PHPQueryObject:
<strong> Fast& Strong IÂ Concrete</strong>
PHPQueryObject run through Find() function:
<strong> Fast & Strong IÂ Concrete</strong>
Tried various combinations of htmlentities()
, html_entity_decode()
, iconv()
to handle the movement of the data and maintain the original structure without displaying a bunch of unnecessary characters. I think this is a limitation of phpquery’s ability to consume html, so I need a work around.
I’ve been successful removing the  and other unneeded characters by using iconv("UTF-8", "BIG5//IGNORE")
but it is somewhat destructive to the original html since it’s intended for Traditional Chinese Characters.
Question: What are Â
and
and how can I handle them so the consumed html #2 and #3 above display as originally intended #1 above without displaying extra characters to the browser?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论