What are the reasons behind URLEncodedFormat()
escaping valid URL characters?
valid characters:
- _ . ! ~ * " ( )
The CF8 Doc said, "[URLEncodedFormat()
escapes] non-alphanumeric characters with equivalent hexadecimal escape sequences." However, why escape valid URL characters?
Special characters needing encoding are: ':' , '/' , '?' , '#' , '[' , ']' , '@' , '!' , '$' , '&' , "'" , '(' , ')' , '*' , '+' , ',' , ';' , '=' , as well as '%' itself.
Why do we need to encode? URLs can only have certain characters from the standard 128 character ASCII set. Reserved characters that do not belong to this set must be encoded. This means that we need to encode these characters when passing into a URL.
%23 is the URL encoded representation of # . I suspect your rewrite rules will not satisfy %23 . You ought to investigate how the response is being constructed. Specifically, any URL encoding functions. However, it would be possible to solve your issue with a rewrite rule.
They are valid, but it seems pretty normal to me that if you ask a programming language to url encode a string that it converts all non alpha numeric chars to the hex equivalent.
ASP's Server.URLEncode() does the same and php urlencode() does too except for - and _. Also, in javascript, the encodeURIComponent() function will encode all non alpha numeric chars to hex equivalents.
This is a good idea anyway to encode all non alpha numeric characters when using user input for forming server requests to prevent anything unexpected from happening.
Is the encoding of valid url characters causing an error or a problem?
One issue might be that by not doing so, if you embed a link with non-encoded characters in an email, the email software may decide to break the link into two lines.
If you use a fully encoded url though, the chances of this are greatly reduced. Just one way of seeing it though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With