Project

General

Profile

Bug #14358

URI.encode_www_form_component doesn't encode bad chars properly

Added by phluid61 (Matthew Kerwin) almost 2 years ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
[ruby-core:84868]

Description

URI.encode_www_form_component "\u02DA", Encoding::WINDOWS_1252
#=> "%26730%3B"

# Expected:
#=> "%26%23730%3B"

As per http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data :

"For each character in the entry's name and value that cannot be expressed using the selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND character (&), a "#" (U+0023) character, one or more ASCII digits representing the Unicode code point of the character in base ten, and finally a ";" (U+003B) character."


Files

uri_encoding.patch (556 Bytes) uri_encoding.patch phluid61 (Matthew Kerwin), 01/15/2018 11:52 AM
uri-encode-form-compontent.patch (1.52 KB) uri-encode-form-compontent.patch jeremyevans0 (Jeremy Evans), 06/20/2019 09:49 PM

Associated revisions

Revision a2c26fe1
Added by jeremyevans (Jeremy Evans) about 2 months ago

Fix fallback in URI.encode_www_form_component to include #

Patch from Matthew Kerwin.

Fixes [Bug #14358]

History

#1

Updated by phluid61 (Matthew Kerwin) almost 2 years ago

  • ruby -v set to ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Updated by jeremyevans0 (Jeremy Evans) 5 months ago

I agree this is a bug that should be fixed, and the patch is a proper way to fix it. Attached is an updated patch that applies against the master branch, along with a test.

#3

Updated by jeremyevans (Jeremy Evans) about 2 months ago

  • Status changed from Assigned to Closed

Applied in changeset git|a2c26fe1c6d49b54494b7c6301cc4c77596eec0c.


Fix fallback in URI.encode_www_form_component to include #

Patch from Matthew Kerwin.

Fixes [Bug #14358]

Also available in: Atom PDF