When calling url() with a path such as

"path/to/file & name.jpg"

it will incorrectly encode it as:

"http://servername.com/path/to/file+%2526+name.jpg"

This is due to the use of urlencode inside of rawurlencode() in drupal_urlencode() function.

Expected Output: Filename encoding follows RFC1738
Actual Output: Filename encoded by urlencode()

CommentFileSizeAuthor
drupal_urlencode.patch850 bytesharking

Comments

harking’s picture

Just read: http://drupal.org/node/139758

I disagree with Steven in his argument that urlencode should be used as it outputs "+" for space.
The urlencode function does not conform the the url spec., and thus should not be used in a project that strives for standards compliance.

ms2011’s picture

Files/URLs are not accessible if they contain reserved or non-ascii characters.
See url_generation.patch here http://drupal.org/node/43505#comment-316523

sun’s picture

Status: Active » Closed (duplicate)