From: merch-redmine@... Date: 2019-06-20T21:50:49+00:00 Subject: [ruby-core:93291] [Ruby trunk Bug#14358] URI.encode_www_form_component doesn't encode bad chars properly Issue #14358 has been updated by jeremyevans0 (Jeremy Evans). Assignee set to akira (akira yamada) Status changed from Open to Assigned File uri-encode-form-compontent.patch added 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. ---------------------------------------- Bug #14358: URI.encode_www_form_component doesn't encode bad chars properly https://bugs.ruby-lang.org/issues/14358#change-78762 * Author: phluid61 (Matthew Kerwin) * Status: Assigned * Priority: Normal * Assignee: akira (akira yamada) * Target version: * ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- ~~~ruby 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-encode-form-compontent.patch (1.52 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: