From: Yui NARUSE Date: 2011-06-26T16:33:43+09:00 Subject: [ruby-core:37442] [Ruby 1.9 - Bug #4167][Closed] URI.encode encodes reserved character of # Issue #4167 has been updated by Yui NARUSE. Status changed from Open to Closed URI.encode is obsoleted. Note that HTML5 seems specify the behavior of escaping and unescaping for addressbar. Future URI module may have such methods. ---------------------------------------- Bug #4167: URI.encode encodes reserved character of # http://redmine.ruby-lang.org/issues/4167 Author: George M. Harkin Status: Closed Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] =begin URI.encode's default behavior is to follow RFC 2732 [http://tools.ietf.org/html/rfc2732] which includes # in the list of characters to URI encode. The updated RFC 3896 [http://tools.ietf.org/html/rfc3986#section-2.2] includes # in the list of reserved characters. This bug is present in Ruby 1.8 too. Observed behavior: require 'uri' enc = URI.encode("http://google.com/moo?testo=true#anchor21") => "http://google.com/moo?testo=true%23anchor21" Expected behavior: require 'uri' enc = URI.encode("http://google.com/moo?testo=true#anchor21") => "http://google.com/moo?testo=true#anchor21" =end -- http://redmine.ruby-lang.org