>Shouldn't the % sign have been encoded before you try decoding it?  
>
>Russ

No, When dealing with data from external sources, you don't always have the 
luxury of knowing for sure whether some string of info has already been 
URLEncoded or not.  Call it bad coding on the part of the source or whatever, 
but that doesn't change the reality.. sometimes you can get passed information 
that you need to process and have it Encoded first in some instances and not in 
others.  I've even had people pass data to me that url decodes to something 
like:

blah=blah&parameters=size:100%|dimensions:3.5%22+x+4.0%22|value:data

(%22) = doublequotes for those who don't know of the top of their heads.

Of course, the variable URL.parameters will hold the cryptic data string, but 
after splitting on the pipe character, each subset has to then be split on 
colon and the right side urldecoded.. but it isn't always urlencoded, but 
sometimes it is..  And in this particular instance, for some reason the 
percentage value isn't encoded, but there are other values, like size:5%22 that 
that could be in the exact same position are..  monkeys.. it has to be monkeys.

At any rate.. when you don't have access to change the way the data is sent, 
you make adjustments to your logic and do the best you can, but not when you 
have a URLDecode that makes assumptions.. so I converted a function into cf 
from another language that checks first to be sure what's after the percent 
sign is a hex value..  There is still the possibility of corruption if what 
comes after a percent that wasn't encoded happens to be a valid hex value, but 
that should be rare... and there is the serious possibility of nuked plus 
signs, but that's the price you pay when you hire monkeys. ;)

I've even had people Encode data twice and expect me to magically figure out 
what to do with it... sometimes I can, sometimes I can't.. I mean.. how can you 
tell if you are supposed to decode the whole string or just sub-parts if they 
can't make up their mind on how they are encoding it.. those people I usually 
tell to forget it. :)

Anyway, just wanted to make people aware of the behavior, since it doesn't act 
like 98% of other URLDecode functions out there :)

--
Pat

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268254
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to