From 5a03a3d7b8478feecea1632a4a77353ac69f1e44 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Fri, 29 Dec 2023 10:21:43 -0500 Subject: [PATCH] wip: try to get weird encoding failure to pass --- lib/mechanize.rb | 2 ++ test/test_mechanize_http_agent.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mechanize.rb b/lib/mechanize.rb index 60e52860..1fd1ca70 100644 --- a/lib/mechanize.rb +++ b/lib/mechanize.rb @@ -12,6 +12,8 @@ require 'webrick/httputils' require 'zlib' +Nokogiri::EncodingHandler.alias("UTF-8", "UTF8") + ## # The Mechanize library is used for automating interactions with a website. It # can follow links and submit forms. Form fields can be populated and diff --git a/test/test_mechanize_http_agent.rb b/test/test_mechanize_http_agent.rb index f6beb06d..813c3a42 100644 --- a/test/test_mechanize_http_agent.rb +++ b/test/test_mechanize_http_agent.rb @@ -1309,8 +1309,8 @@ 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 + assert_equal 'UTF-8', page.encoding + assert_equal 'UTF-8', page.parser.encoding end def test_response_parse_content_type_encoding_garbage