There can be few items to check up.
What is the charset in HTML? Should be something like that:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
It's not mandatory to have a text-file BOM matching this charset, but do you have it? (Your text editor should have options "Save as UTF-8 files", "Save as Unicode files", see Unicode standard for BOMs. The constructor of the class
System.IO.StreamReader
constructor has a parameter
detectEncodingFromByteOrderMarks
; if this is true, the reader looks at the BOM at the beginning of the file.
Why do you have this stream with default encoding? Look at your line:
var stream = new StreamReader(strHTMLpath, Encoding.Default).ReadToEnd();
This could be a mistake.
Persian language is covered by Unicode exactly as most other languages, processing Persian usually never cause any problems.
—SA