tracker issue : CF-3953329

select a category, or use search below
(searches all categories and all time range)
Title:

EncodeForURL encoding spaces as + instead of %20

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/Workaround

Reporter/Name(from Bugbase): Giancarlo Gomez / Giancarlo Gomez (Giancarlo Gomez)

Created: 03/15/2015

Components: Language

Versions: 11.0

Failure Type: Usability Issue

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: ALL / Mac 10 All

Vote Count: 1

I did not know if this was expected behavior but when I used the new EncodeForURL function, spaces where rendered as "+" instead of "%20", which caused issues reading an image from an IIS server.

http://www.giancarlogomez.com/2015/03/coldfusion-11-issue-with-encodeforurl.html

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3953329

External Customer Info:
External Company:  
External Customer Name: Giancarlo
External Customer Email:

Attachments:

Comments:

Is it perhaps related to this: http://en.wikipedia.org/wiki/Percent-encoding#The_application.2Fx-www-form-urlencoded_type ?
Comment by External U.
8038 | March 16, 2015 01:27:18 AM GMT
Hi Giancarlo and Adam, I noticed the same. Example: Example 1: <cfoutput><a href="mailto:#encodeForURL('user@domain.com')#?subject=#encodeForURL('the subject')#&amp;body=#encodeForURL('the body')#">link</a></cfoutput> Output 1: <a href="mailto:user%40domain.com?subject=the+subject&amp;body=the+body">link</a> Microsoft Outlook, when user clicks the link, doesn't replace the + w/ spaces. Example 2: <cfoutput><a href="mailto:#encodeForURL('user@domain.com')#?subject=#replace(encodeForURL('the subject'), '+', '%20', 'all')#&amp;body=#replace(encodeForURL('the body'), '+', '%20', 'all')#">link</a></cfoutput> Output 2: <a href="mailto:user%40domain.com?subject=the%20subject&amp;body=the%20body">link</a> Microsoft Outlook, when user clicks the link, does replace the %20 w/ spaces. Adobe, in this case, %20 is preferred over +. So we should be able to choose which one encodeForURL() uses for encoding spaces. Thanks!, -Aaron
Comment by External U.
8039 | May 07, 2015 07:15:10 PM GMT
+1 - encodeForURL() should allow us to choose if spaces are encoded as + or %20.
Vote by External U.
8043 | May 07, 2015 07:16:01 PM GMT
EncodeForURL internally uses ESAPI url encoder which encoding space as +. If one wants the behavior of space as %20 can use the workaround of replacing + with %20 after encoding the string.
Comment by S V.
8040 | September 23, 2015 09:19:49 AM GMT
Hi S V Pavankumar, Could that be added to the EncodeForURL doc? ---------------------- EncodeForURL encodes spaces as '+'. If '%20' is desired, then replace '+' with '%20' after encoding the string. ---------------------- Thanks!, -Aaron
Comment by External U.
8041 | September 23, 2015 12:37:58 PM GMT
Updated the docs https://wikidocs.adobe.com/wiki/display/coldfusionen/EncodeForURL. Thanks, Pavan.
Comment by S V.
8042 | September 24, 2015 05:23:56 AM GMT