将非英语文本转换为可读格式
我从网络获取字符串,这些字符串通常包含我的应用程序中无法识别的重音字符。
编辑 - 我正在使用 HtmlAgilityPack 获取字符串。我正在获取
// get the html title inner text and assign to htmlParts object
HtmlNode titleNode = doc.DocumentNode.SelectSingleNode("//title");
string docTitle = titleNode.InnerText;
htmlParts.htmlTitle = docTitle.ToString();
谁能告诉我如何从 "(Subtitulado al español).avi"
变为 "(Subtitulado al español).avi"
?
我将非常感激。 :)
I am obtaining strings from the web which often contain accented characters not recognised from within my application.
Edit - I'm obtaining my string using the HtmlAgilityPack. I am taking the InnerText
of a <title>
tag. Whilst doing this the Pack uses a different encoding from the original HTML document (I'm not sure which ones though?).
// get the html title inner text and assign to htmlParts object
HtmlNode titleNode = doc.DocumentNode.SelectSingleNode("//title");
string docTitle = titleNode.InnerText;
htmlParts.htmlTitle = docTitle.ToString();
Can anyone tell me how I can go from getting "(Subtitulado al español).avi"
to "(Subtitulado al español).avi"
?
I'd very much appreciate it. :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您正在获取 UTF-8,但将其处理为 ISO-8859-1。
如果不了解更多关于您的系统的信息,就不可能提供更具体的信息。
It looks like you're getting UTF-8, but processing it as ISO-8859-1.
It's not possible to give more concrete information without knowing more about your system.
对您读取的数据应用正确的编码。具体如何?好问题。为此,您至少需要首先提供导致问题的代码。
apply proper encoding to the data you read. How exactly? Good question. For that you at least need to provide the code that causes the problem in the first place.