sparklemotion / mechanize

Mechanize is a ruby library that makes automated web interaction easy.
https://www.rubydoc.info/gems/mechanize/
MIT License
4.39k stars 473 forks source link

fix: correctly recognize encoding errors in libxml >= 2.12.0 #644

Closed flavorjones closed 2 months ago

flavorjones commented 2 months ago

Starting with libxml2 v2.12.0, encoding errors have a message that was not being detected by Page#encoding_error? resulting in a page that was parsed using incorrect encoding.

This change updates Page to detect those errors as encoding errors and as a result we get the expected encoding back on the parsed document.