2012-07-15 63 views
0

只是一個簡單的快速問題。我想在我的HTTP請求中傳遞一個日期。日期格式是這樣的22\July\2012。這是我想要傳遞的URL。凡dateChat =22\July\2012在URL中傳遞帶反斜槓的日期:Android

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); 

的logcat的是給了以下錯誤:

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 

回答