Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pound signs in a link

Status
Not open for further replies.

ljevans

Technical User
Apr 4, 2001
53
US
I have a lookup table that contains file names. A # sign is included in some of the file names. In the following code #sow_file_name# should bring up a word document called 8532sow(Encore#2).doc.

Code:
<cfoutput query=&quot;get_sow&quot;><a href=&quot;\\net-app\de_data\sow_file\#sow_file_name#&quot; target=&quot;_right&quot;>#sow_file_name#</a><br></cfoutput>

The document can not be found becasue the address only reads 832sow(Encore. I have no control over the naming of the files. Any help would be appreciated.
 
you'll have to escape the # symbol by replacing it with ##

try
#Replace(sow_file_name, &quot;#&quot;, &quot;##&quot;)#

instead of
#sow_file_name#
 
When reading from a database, ColdFusion automatically escapes all # signs. If the #'s weren't being excaped, you'd be getting a ColdFusion error.

I'm not exactly sure why # signs coming from a db field would cut off part of the string. Have you looked at the actual HTML source to see what it is outputing? I would suggest, however, that you use the URLEncodedFormat() function to ensure that any odd characters are translated correctly in the href.

<cfoutput query=&quot;get_sow&quot;><a href=&quot;\\net-app\de_data\sow_file\#URLEncodedFormat(sow_file_name)#&quot; target=&quot;_right&quot;>#sow_file_name#</a>[COLOR=000080]<br>[/color]</cfoutput> - tleish
 
The URLEncodedFormat did the trick. Thanks for the help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top