From: Hannes Wyss Date: 2009-06-24T16:55:29+09:00 Subject: Ruby 1.9.1, HTTP and Encodings Hi All I'm running into a "Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT" when using Selenium to run my functional tests, specifically when calling assert_equal to compare the expected value 'Bestätigung' with the value retrieved by Selenium from the web-page. The expected value is correctly encoded as UTF-8, the value retrieved by Selenium is labeled ASCII-8BIT. Otherwise they are identical. (see also http://trac.ywesee.com/ticket/1#comment:13) I've tracked the issue down to http. I believe it would be very helpful if HTTP could force the encoding of the received body to the value provided in the Content-Type-header. Or, failing that, to the default internal encoding. Have others run into the same issue? How did you solve it? Thanks in advance, all the best, Hannes hwyss@work ~ $ uname -a Linux work 2.6.27.4 #1 SMP PREEMPT Wed Nov 5 17:07:20 CET 2008 x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux hwyss@work ~ $ ruby19 --version ruby 1.9.1p129 (2009-05-12 revision 23412) [x86_64-linux] hwyss@work ~ $ irb19 --version irb 0.9.5(05/04/13) hwyss@work ~ $ irb19 irb(main):001:0> Encoding.default_internal = 'UTF-8' => "UTF-8" irb(main):002:0> require 'net/http' => true irb(main):003:0> Net::HTTP.start('ch.oddb.org') do |http| http.get('/').body.encoding end => #