如何使用HTMLAgilityPack处理重音问题 [英] How to deal with accent problems using HTMLAgilityPack

查看:39
本文介绍了如何使用HTMLAgilityPack处理重音问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试提取html文件的文本,但是标记内部显示以下文本:

I'm try to extract the text of a html file, but inside of tag appears the following text:

<h3>Café<h3>

,并使用以下代码提取文本时:

and when extract the text using the following code :

htmlDocument.DocumentNode.SelectSingleNode("some XPath").InnerText;

我得到这个字符串Cafédirect".如何解决呢?

I get this string "Cafédirect" . How could fix this ?

推荐答案

我现在知道了答案,正在工作,我已经找到了解决方法,可以去这里:

I know the answer now, working I detect the way to do , here go :

htmlDocument.OptionDefaultStreamEncoding = Encoding.UTF8;

默认情况下,编码为System.Text.Encoding.默认为UTF-8,允许重音

By default the encoding is System.Text.Encoding.Default with UTF-8 the accents are permitted

这篇关于如何使用HTMLAgilityPack处理重音问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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