Just a simple quick question. I want to pass a date in my HTTP request. The date format is like this 22\July\2012. Here’s the URL which I am trying to pass. Where dateChat =22\July\2012
if(this.dateChat!="") {
this.dateChat.replace("\\", "\\\\");
}
httpclient= new DefaultHttpClient();
httpget = new HttpGet("http://10.116.27.107/php/Chat/xmlManipulator.php?" +
"action="+this.action+"&username="+this.userName+
"&chatText="+this.chatText+"&email="+this.email+
"&callfrom="+this.callFrom+"&dateChatToRetrieve="+this.dateChat);
The logcat is giving the following error:
07-15 20:26:40.165: E/AndroidRuntime(2000): FATAL EXCEPTION: main
07-15 20:26:40.165: E/AndroidRuntime(2000): java.lang.IllegalArgumentException:
Illegal character in query at index 146:
http://10.116.27.107/php/Chat/xmlManipulator.php?action=ReturnUserAdminChats&username=You&chatText=a&email=You&callfrom=admin&dateChatToRetrieve=5\July\2012
Use URLEncoder.encode() to encode dateChat