[#100689] [Ruby master Feature#17303] Make webrick to bundled gems or remove from stdlib — hsbt@...
Issue #17303 has been reported by hsbt (Hiroshi SHIBATA).
11 messages
2020/11/02
[#100852] [Ruby master Feature#17326] Add Kernel#must! to the standard library — zimmerman.jake@...
Issue #17326 has been reported by jez (Jake Zimmerman).
24 messages
2020/11/14
[#100930] [Ruby master Feature#17333] Enumerable#many? — masafumi.o1988@...
Issue #17333 has been reported by okuramasafumi (Masafumi OKURA).
10 messages
2020/11/18
[#101071] [Ruby master Feature#17342] Hash#fetch_set — hunter_spawn@...
Issue #17342 has been reported by MaxLap (Maxime Lapointe).
26 messages
2020/11/25
[ruby-core:100751] [Ruby master Misc#17309] URI.escape being deprecated, yet there is no replacement
From:
shyouhei@...
Date:
2020-11-09 02:19:18 UTC
List:
ruby-core #100751
Issue #17309 has been updated by shyouhei (Shyouhei Urabe). Re: the reason why `URI.escape` is deprecated and also why there is no transition path: URI, in general, is a "structured" construct. It has schema, host, path, query, fragment, and each of them have _different_ ways to escape a character. OTOH when you do `URI.escape`, it's because you want to make an invalid URL valid, like you mentioned. This means the input string's structure is broken. _Yet_, you have to find a right structure inside of the broken string and properly apply escape sequences for each of them. This is, simply, impossible. What is broken is broken. You can't fix one. So in short what was bad about `URI.escape` is the idea of escaping a broken URL itself. This is why it is deprecated and there will be no alternative. ---------------------------------------- Misc #17309: URI.escape being deprecated, yet there is no replacement https://bugs.ruby-lang.org/issues/17309#change-88398 * Author: chucke (Tiago Cardoso) * Status: Open * Priority: Normal ---------------------------------------- I'm on ruby 2.7.2 . The moment I do ```ruby uri = "http://bher.ch" URI.escape uri (irb):5: warning: URI.escape "http://b%C3%BCcher.ch" ``` I get that warning. Rubocop also tells me: """ URI.escape method is obsolete and should not be used. Instead, use CGI.escape, URI.encode_www_form or URI.encode_www_form_component depending on your specific use case. """ However, none of the suggestions does the same as `URI.escape`. ```ruby CGI.escape uri => "http%3A%2F%2Fb%C3%BCcher.ch" URI.encode_www_form_component uri => "http%3A%2F%2Fb%C3%BCcher.ch" URI.encode_www_form uri Traceback (most recent call last): NoMethodError (undefined method `map' for "http://bher.ch":String) Did you mean? tap ``` So my question is: why is this being deprecated? And if there's still reason, what to exactly replace it for, so I can keep the exact same behaviour? -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>