digitalmars.D.bugs - [Issue 1346] New: std.uri.decode/decodeComponent do not decode '+' plus
- d-bugmail puremagic.com (22/22) Jul 18 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1346
- d-bugmail puremagic.com (12/12) Sep 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1346
- d-bugmail puremagic.com (20/20) Sep 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1346
- d-bugmail puremagic.com (7/7) Sep 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1346
- d-bugmail puremagic.com (6/6) Sep 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1346
- d-bugmail puremagic.com (11/11) Sep 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1346
http://d.puremagic.com/issues/show_bug.cgi?id=1346 Summary: std.uri.decode/decodeComponent do not decode '+' plus Product: D Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: alan akbkhome.com std.stdio.writefln("%s", std.uri.decode("cat+dog")); expected output: "cat dog" actual output "cat+dog" (you would normally get this by posting a web page with a space (eg. search for something with a space on google) Suggested Fix: Line 269 of std/uri.d if (C == '+') { R[Rlen] = ' '; Rlen++; continue; } --
Jul 18 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1346 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID Summary|std.uri.decode/decodeCompone|std.uri.decode/decodeCompone |nt do not decode '+' plus |nt do not decode '+' plus ------- Comment #1 from bugzilla digitalmars.com 2007-09-03 15:02 ------- They are not supposed to decode '+'. URI encode/decode are supposed to be reversible operations, and changing '+' to ' ' is not reversible. --
Sep 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1346 alan akbkhome.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | ------- Comment #2 from alan akbkhome.com 2007-09-03 18:59 ------- http://hk.php.net/manual/en/function.urlencode.php "Returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type. This differs from the ยป RFC 1738 encoding (see rawurlencode()) in that for historical reasons, spaces are encoded as plus (+) signs." It looks like it was necessary to produce 2 versions in PHP, as real-world usage demanded the ability to encode and decode real-urls, as per the x-www-frm-urlencoded media type. I've bumped it to a enhancement - although it's pretty critical if you use D to respond to CGI requests.. --
Sep 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1346 ------- Comment #3 from alan akbkhome.com 2007-09-03 19:01 ------- enhancement being that either another method is required, or an additional flag to decode/encode... I'd leave the bug as open "fix needed" - as the original fix is more a workaround now. --
Sep 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1346 alan akbkhome.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement --
Sep 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1346 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |INVALID ------- Comment #4 from bugzilla digitalmars.com 2007-09-03 20:51 ------- The encode/decode functions correspond to the equivalent functions in the ECMA 262 spec (i.e. javascript). I'm very reluctant to deviate from it, considering how pervasive javascript is. --
Sep 03 2007