Encode documents according to XML declaration tags / HTML charset tags
Currently Oga just uses Ruby's default encoding when parsing documents. XML documents however can specify the document encoding using XML declaration tags (e.g. <?xml encoding="..." ?>
). In HTML documents a <meta charset="..." />
can also be used for this.
I'm not sure if Oga should automatically change the encoding or not. For example, what should happen if the encoding value is not recognized by Ruby? It could also have some performance drawbacks when parsing. First the document would be encoded in the default encoding, then it would be changed to whatever the document specifies.
In case I decided not to add this I should at least document the rationale behind that choice.