Feature #15961


Always warn for URI.{,un}{escape,encode}

Added by jeremyevans0 (Jeremy Evans) about 3 years ago. Updated almost 3 years ago.

Target version:


These methods have both had a verbose mode warning for almost 10 years. If we ever plan on removing them, we should switch from a verbose mode warning to a regular warning. If we don't, people will still use them, and run into their problems (see #12235, #9806).


uri-escape-always-warn.patch (1.18 KB) uri-escape-always-warn.patch jeremyevans0 (Jeremy Evans), 06/26/2019 08:27 PM

Updated by zverok (Victor Shepelev) about 3 years ago

I am not sure, but can this warning be more helpful? Like method's documentation, which says:

This 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.

Or is there a reason/standard/convention for warnings to be brief, even if less useful?..

Updated by shevegen (Robert A. Heiler) about 3 years ago

I am not sure if such a verbose message would make sense, even more so as
long as the ruby user has no trivial way to silence a particular warning
(without e. g. the $VERBOSE trick to assign to a new value, make a change,
then re-assign to the old one).

In general, while you can argue that a more verbose warning can be more
helpful, in ruby it is often the case that warnings are sort of short.
I can not say whether this is deliberate or may be inspired by japanese
devs playing with english and having fun (see zombie threads) :) - but
I believe that, for consistency, it may be better to be short/succinct
if possible. In the long run perhaps ruby may provide more fine-tuned
control over warnings but I think matz has to think about this, perhaps
past ruby 3.0. There is actually quite a lot of ruby that focuses on
the "human side of errors/problems", if you think about it - the did-you-
mean gem too. Rubocop too, if you think about it from an "enforce a
spec for consistency" point of view (e. g. autocorrect option, if it
works, in a ruby project).

I have no particular opinion about the change itself but I think jeremy
has a valid point with reallife problems encountered in this regard (e. g.
the old bug reports).

Actions #3

Updated by jeremyevans (Jeremy Evans) almost 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|869e2dd8c8efc1e7a043c9eee82d97c47befbcc7.

Warn for URI.{,un}{escape,encode}, even if not in verbose mode

The verbose mode warning has been present for almost 10 years.
If we ever plan to remove these methods, we should make the warning
a regular deprecation warning so that people are aware.

Implements [Feature #15961]


Also available in: Atom PDF