title: HTMLAgilityPack Why are Attributes not correctly encoded after reading Utf-8 Encoded File
body: <p>I am reading a HTML file that is utf-8 encoded:</p>
  <pre><code>htmlDocument = new HtmlDocument();
  htmlDocument.Load( filePath );
  </code></pre>
  <p>The file contains a valid <code>&lt;meta charset=&quot;UTF-8&quot;&gt;</code> tag, and after loading, the <code>Encoding</code> property of <code>htmlDocument</code> is correctly set to <code>System.Text.Encoding.Utf8</code>.</p>
  <p>However, if I read an attribute from a node:</p>
  <pre><code>        var node = document.GetElementbyId( id );
          var filename = node.Attributes[&quot;filename&quot;].Value;
  </code></pre>
  <p>the string is not correct if the <code>filename</code> attribute contains non-ASCII characters.
  I have to convert the encoding manually from UTF-8:</p>
  <pre><code>            var bytes = System.Text.Encoding.GetEncoding(1252).GetBytes( encodedString );
              var attr = document.Encoding.GetString( bytes );
  </code></pre>
  <p>Is this by design?
  If the htmldocument's <code>Encoding</code> property is set to UTF-8, I would have expected that the attribute values would already be returned in the correct .Net standard encoding.</p>
  <p>I am using HTMLAgilityPack version 1.8.4.</p>