WPF WebBrowser and special characters like german “umlaute”

前端 未结 4 1354
时光取名叫无心
时光取名叫无心 2020-12-10 22:56

I use the WPF WebBrowser Control in my app. I have a file (mht) which contains german umlaute (ä ö ü). Now, I load this this file with .Navigate(path) but the Problem is, th

4条回答
  •  感情败类
    2020-12-10 23:55

    I was faced with this problem this morning and it annoyed me a lot until I found this solution:

    Stream stream = new MemoryStream(System.Text.Encoding.Default.GetBytes(Content_Of_HTML_File_In_String)));
    webBrowser.NavigateToStream(stream);
    

    Compared to the solution above, you wont expect any "COMException" or something of this sort.

提交回复
热议问题