Url Encode issue in coldfusion

Viewed 882

I am working on a project that I need to pass a string as a url variable. The issue I am haveing is when the strings are being pulled from a database, and contain characters that have to be encoded. When decoding on the other side they drop off after characters like & and +

I can get it to encode and decode properly if I set the string manually... is there a fix or am I doing something wrong.

So for instance If on my encoding page I enter this:

<a href="javascript:ColdFusion.navigate('/jobs/jobTypes.cfm?desc=#encodeForUrl(jobList.list_desc)#', 'center')">Type |</a>

joblist.list_desc is pulling the desc from a cfc that gets the description of a job type and lets say that the description its pulling is "Excavation & Plumbing"

And My recieving page is set up like this:

<cfoutput>
    <table>
         <tr>
            <td width="60%" valign="top" class="subpagetitle">
                 #decodeFromUrl(url.desc)#
            </td>
         </tr>
    </table>
</cfoutput>

It just outputs "Excavation "

Now if I set the string manually like this:

<a href="javascript:ColdFusion.navigate('/jobs/jobTypes.cfm?desc=#encodeForUrl(Excavation & Plumbing)#', 'center')">Type |</a>

Then the url will decode that and out put it like it should be. "Excavation & Plumbing"

If I have it pull a description with out the & in the description it works fine. It will encode and decode spaces, - _ '" all kinds of symbols... I only have this issue when someone has saved a description with the + and & and only when it pulls from the database.

0 Answers
Related