From: "NARUSE, Yui" Date: 2010-04-10T17:30:49+09:00 Subject: [ruby-core:29410] Re: URI.(un)escape deprecated? (2010/04/10 6:54), Marc-Andre Lafortune wrote: > Imagine I want to display a url to the user in a human readable format > (say like the status bar of the browser when a user hovers over a > link). If it is the use case of URI.unescape, the algorithm of it should follow web browsers, doesn't it? Try make a link and mouse over following url; You'll find some of them aren't decoded. http://www.google.com/search?hl=en&q=%2F%3F%23%25%2B%26 Decoding URI is difficult problem and at least URI.unescape is not enough. HTML5/IRI-bis people seem discussing about related this, like http://lists.w3.org/Archives/Public/public-iri/2010Apr/0006.html But if we follow, it must cause breaking compatibility. So deprecating URI.{,un}escape is needed. see also: https://bugzilla.mozilla.org/show_bug.cgi?id=105909 https://bugzilla.mozilla.org/show_bug.cgi?id=497476 > Ruby should have a nice "unescape" for that, and the reverse "escape" too. > > These methods should convert > "http://example.com/?name=Marc%20Andr%C3%A9+42" to > "http://example.com/?name=Marc Andr��+42" and back (exactly what Chrome > does) > > As the code below shows, the only correct escaping is URI.escape. > The only correct unescaping is WEBrick::HTTPUtils.unescape and > URI.unescape. Note that WEBrick currently raises an error when > escaping... If the use case of URI.unescape is to show a human readable format, why escaping is needed? -- NARUSE, Yui