title: Encoding in HTML using HtmlAgilityPack
body: <p>I have a question about Chinese encoding and saving back to a file. I am currently using the HtmlAgilityPack to parse HTML, do some things with it and save it back to the file. I am having a problem with Encoding, such as Chinese (GB2312 (Simplified)). When i open the file, I read the encoding and I save it back, using the HtmlAgilityPack</p>
  <pre><code>doc.Save(this._filePath, reader.CurrentEncoding);
  </code></pre>
  <p>but the Chinese letters get completely mutilated. Any ideas on how I can save back to the same file and maintain the current encoding? I also tried getting the Encoding with the HtmlAgilityPack like such:</p>
  <pre><code>FileStream fs = new FileStream(this._filePath, FileMode.Open);
  
  StreamReader reader = new StreamReader(fs);
  
  HtmlDocument doc = new HtmlDocument();
  doc.Load(reader);
  
  Encoding enc = doc.DeclaredEncoding;
  
  fs.Close();
  
  doc.Save(this._filePath, enc);
  </code></pre>
  <p>but that didn't work either. Any ideas?</p>