#849: MacRuby throws the exception of "Encoding::CompatibilityError" with various cases. ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): It seems to come from cgi/util.rb: {{{ (gdb) p rb_symbolicate (0x0000000102c43acf) addr 0x102c43acf start 0x102c43960 selector unescape: location /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/1.9.2/cgi/util.rb:17 }}} {{{ # URL-decode a string with encoding(optional). # string = CGI::unescape("%27Stop%21%27+said+Fred") # # => "'Stop!' said Fred" def CGI::unescape(string,encoding=@@accept_charset) str=string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/) do [$1.delete('%')].pack('H*') end.force_encoding(encoding) str.valid_encoding? ? str : str.force_encoding(string.encoding) end }}} I suspect our pack function returns binary data by default which can't be concatenated to UTF-8. -- Ticket URL: <http://www.macruby.org/trac/ticket/849#comment:2> MacRuby <http://macruby.org/>