0
Spaces in URLS
Participant
,
/t5/coldfusion-discussions/spaces-in-urls/td-p/102903
Dec 30, 2008
Dec 30, 2008
Copy link to clipboard
Copied
When users on my site submit a report, an email is generated
with cfmail that passes the URL where the report can be found.
On some of the URL strings there are spaces and the link within the mail is not accurate. It dies at the space...
Should I use URLEncodedFormat to solve this issue? I can't have any spaces in the URL or else it won't work correctly.
On some of the URL strings there are spaces and the link within the mail is not accurate. It dies at the space...
Should I use URLEncodedFormat to solve this issue? I can't have any spaces in the URL or else it won't work correctly.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/coldfusion-discussions/spaces-in-urls/m-p/102904#M10022
Dec 30, 2008
Dec 30, 2008
Copy link to clipboard
Copied
I would just make sure the cfmail has a type=html and i would
wrap the url in a <a> tag. The browser will take care of the
encoding.
<cfset urltest = " http://www.google.com?test=test test">
<cfmail to="email@email.com" from="email@email.com" subject="testing" type="html">
<a href="#urltest#">#urltest#</a>
</cfmail>
<cfset urltest = " http://www.google.com?test=test test">
<cfmail to="email@email.com" from="email@email.com" subject="testing" type="html">
<a href="#urltest#">#urltest#</a>
</cfmail>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
idesdema
AUTHOR
Participant
,
/t5/coldfusion-discussions/spaces-in-urls/m-p/102905#M10023
Dec 30, 2008
Dec 30, 2008
Copy link to clipboard
Copied
That's a good idea... but many of the site users are old
school and may not have html enabled email...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/coldfusion-discussions/spaces-in-urls/m-p/102907#M10025
Dec 30, 2008
Dec 30, 2008
Copy link to clipboard
Copied
Ok, since you're not wrapping in html format your sending as
a plain text. So in your case the urlencodedformat won't be an
option as it will just return a encoded format like (ie.
ttp%3A%2F%2Fwww%2Egoogle%2Ecom%3Ftest%3Dtest%20test
http://www.google.com?test=test%20test
) which won't do much for your receipient. So i would just do a
replace on the space with %20 and that should work for html and
plain text format.
<cfset urltest = " http://www.google.com?test=test test">
<cfset urltest = replace(urltest,' ','%20','all')>
This should return in the email
http://www.google.com?test=test%20test
<cfset urltest = " http://www.google.com?test=test test">
<cfset urltest = replace(urltest,' ','%20','all')>
This should return in the email
http://www.google.com?test=test%20test
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/coldfusion-discussions/spaces-in-urls/m-p/102906#M10024
Dec 30, 2008
Dec 30, 2008
Copy link to clipboard
Copied
Since you can't use HTML formatted emails, then you're
initial assumption is correct. URLEncodedFormat() will properly
convert spaces and other pesky URL characters so that any browser
should properly handle the URL request.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/spaces-in-urls/m-p/102908#M10026
Dec 30, 2008
Dec 30, 2008
Copy link to clipboard
Copied
How are the spaces getting there to start with?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

