I really start to hate this control, it seems that a small task is almost impossible. I explored an alternative but did not find anything useful.
I am working on a small e-book editing application. I am using a WebBrowser control to view html files.
At first, I tried very hard not to have Temp files, so I did all this in memory with streams, modifying html to include images encoded in Base64, and including CSS directly in Html. The problem is that the large image does not display correctly, and this forces the user to have IE8 at a minimum.
I searched for other libraries such as Chrome or Firefox Engine, but both are too large to be useful (11 megabytes for preview only when my application is 500 KB in size).
Then I put up with just using temporary files, so I would have better compatibility and less problems with CSS and images.
The problem is that the wrong encoding was detected in some file (on some computers) (windows-1252), which leads to incorrect display of some non-English characters. I want to be forced to UTF-8. If I take the file and encode the text using StreamReader in UTF8 and send them to the DocumentText property, I will lose all the images and create.
public frmPreview(string filename, string Chapter)
{
InitializeComponent();
string Path = Variables.TempFolder + "\\" + Utils.GetFilePathInsideZip(filename);
webBrowser1.Navigate(Path);
webBrowser1.Document.Encoding = "utf-8";
this.Text = Chapter;
}
1 - How to force page encoding, regardless of computer settings?
, , CSS , , , ( ) . Navigate, CSS .
XHTML ( Windows ). , , .
2 - XHTML ?