WPF WebBrowser NavigateToString 与 NavigateToStream(希伯来语/非 utf8 编码)

发布于 2024-09-01 03:38:33 字数 374 浏览 4 评论 0原文

当我使用 WPF WebBrowser 的 NavigateToString 方法显示 UTF8 html(其中包含希伯来语文本)时,它显示得完美。

但是,当我尝试使用 NavigateToString 以非 utf8 编码(确切地说是 CodePage 1255)显示带有希伯来语文本的 html 时,希伯来语变得混乱。

我在 Visual Studio 的调试器中检查了 cp1255 字符串,它看起来很棒,而且当我保存 Web 浏览器内容的源代码并使用外部浏览器打开它时,它看起来很棒。

如果我使用 NavigateToStream 方法而不是 NavigateToString 方法,它会很好用。

NavigateToString 有什么问题?我做错了什么吗?

When I use WPF WebBrowser's NavigateToString method to display UTF8 html (with hebrew text in it) it's displayed perfectly.

However, when I try to use the NavigateToString to display html with hebrew text in it in a non-utf8 encoding (CodePage 1255 to be exact) the hebrew is messed up.

I checked the cp1255 string in Visual Studio's debugger and it looks great, and also when I save the source of the web browser's contents and open it with an external browser it looks great.

If I use the NavigateToStream method instead of the NavigateToString method it works great.

What's the problem with the NavigateToString? am I doing something wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪痕残 2024-09-08 03:38:33

NavigateToString = NavigateToStream + UTF8NoBOM
使用 NavigateToStream 并确保流数据中的编码正确。

NavigateToString= NavigateToStream + UTF8NoBOM
Use NavigateToStream and make sure you have the correct encoding in the stream data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文