Skip to content

Commit

Permalink
test: accept "UTF-8" as an encoding alias for "UTF8"
Browse files Browse the repository at this point in the history
as of libxml 2.12.0, the result of this test is dependent on how
libiconv is built (which aliases are supported), and it started
failing on windows and macos (but strangely, not linux).

if the alias "UTF8" is defined, then the result will be "UTF-8".
if the alias "UTF8" is not defined, then the result will be "UTF8".
  • Loading branch information
flavorjones committed Dec 29, 2023
1 parent 245cc78 commit 3452150
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/test_mechanize_http_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1309,8 +1309,13 @@ def test_response_parse_content_type_encoding_broken_utf_8
page = @agent.response_parse @res, body, @uri

assert_instance_of Mechanize::Page, page
assert_equal 'UTF8', page.encoding
assert_equal 'UTF8', page.parser.encoding

# as of libxml 2.12.0, the result is dependent on how libiconv is built (which aliases are supported)
# if the alias "UTF8" is defined, then the result will be "UTF-8".
# if the alias "UTF8" is not defined, then the result will be "UTF8".
# note that this alias may be defined by Nokogiri itself in its EncodingHandler class.
assert_includes ["UTF8", "UTF-8"], page.encoding
assert_includes ["UTF8", "UTF-8"], page.parser.encoding
end

def test_response_parse_content_type_encoding_garbage
Expand Down

0 comments on commit 3452150

Please sign in to comment.