1

I use this code to set the charset of a Document which is loaded in the WebBrowser-Control

static void webBrowser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e) {
    var webBrowser = sender as WebBrowser;
    if(webBrowser == null) {
        return;
    }
    var doc = (IHTMLDocument2)webBrowser.Document;           

    doc.charset = "utf-8";
    webBrowser.Refresh();
}

from here: WPF WebBrowser and special characters like german "umlaute"

This is generally working. But some documents are only showing right when I disable auto-charset-detection with over the ContextMenu of the WebBrowser-Control.

I am now searching for a way to turn off auto-charset-detection with code.

Community
  • 1
  • 1
BennoDual
  • 5,865
  • 15
  • 67
  • 153

0 Answers0