Solution for url decoding contents including percentage symbol
As I use JSONObject to parse payload, I occasionally found a exception is raised. A percentage symbol (%) is contained in the payload and java.net.URLDecoder.decode fail to decode it.
The solution is pretty simple: replace the percentage symbol as a encoded percentage symbol %25.
payload = m_payload.replaceAll("%(?![0-9a-fA-F]{2})", "%25"); payload = m_payload.replaceAll("\\+", "%2B"); payload = java.net.URLDecoder.decode(m_payload, "UTF-8");











