Detect the URI encoding automatically in Tomcat

The complicated way to achieve my goal was indeed to write my own javax.servlet.Filter and to embed it into the filter chain. This solution complies with the Apache Tomcat suggestion provided in Tomcat Wiki – Character Encoding Issues. Update (2010-07-31): The first version of this filter interpreted the query string itself, which was a bad … Read more

NameValueCollection to URL Query?

Simply calling ToString() on the NameValueCollection will return the name value pairs in a name1=value1&name2=value2 querystring ready format. Note that NameValueCollection types don’t actually support this and it’s misleading to suggest this, but the behavior works here due to the internal type that’s actually returned, as explained below. Thanks to @mjwills for pointing out that … Read more

PHP URL Encoding / Decoding

The weird characters in the values passed in the URL should be escaped, using urlencode(). For example, the following portion of code : echo urlencode(‘dsf13f3343f23/23=’); would give you : dsf13f3343f23%2F23%3D Which works fine, as an URL parameter. And if you want to build aquery string with several parameters, take a look at the http_build_query() function. … Read more