[PATCH] ERB::Util.url_encode should not escape unreserved characters
ERB::Util.url_encode is escaping tilde (~) where it should not according to the RFC.
This fixes that behaviour so that it now correctly avoids escaping all unreserved characters as per RFC 3986, Section 2.3:
Fwiw., this is also how the Perl implementation works:
I opened this issue originally on Github, but I think it warrants further discussion, so re-opening here.
#2 [ruby-core:46177] Updated by shyouhei (Shyouhei Urabe) almost 6 years ago
- Subject changed from [PATCH] to [PATCH] ERB::Util.url_encode should not escape unreserved characters
- Status changed from Open to Feedback
FYI, the old discussion is at https://github.com/ruby/ruby/pull/54
I see the patch itself is OK. The question is to be or not to be able to escape tilde.
#4 [ruby-core:46223] Updated by duerst (Martin Dürst) almost 6 years ago
The tilde was added to the unreserved characters in URIs in RFC 2396. It is specifically mentioned in http://tools.ietf.org/html/rfc2396#appendix-G.2:
The tilde "~" character was added to those in the "unreserved" set,
since it is extensively used on the Internet in spite of the
difficulty to transcribe it with some keyboards.
RFC 2396 was published in August 1998, about 14 years ago. I think it's safe to make this change now :-).
#9 Updated by k0kubun (Takashi Kokubun) about 1 year ago
- Status changed from Assigned to Closed
#10 [ruby-core:81829] Updated by usa (Usaku NAKAMURA) 11 months ago
- Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: WONTFIX, 2.3: WONTFIX, 2.4: UNKNOWN
memo: I think that this is a bug, but it may surprise users to change this behavior at teeny releases. Therefore I decided not to backport this to ruby_2_3 branch.