android http post base 64 string to .net wcf
This is urgent. I am trying to post an image convert to base 64 string. This is my Android (java) code.
private String decodeUTF8(byte[] bytes) {
return Base64.encodeToString(bytes,0);
}
String json = "{\"Image\":\""+img+"\",\"Locationxy\": \"" + location
+"\", \"PestInfo\": \"" + pestInfoTxt.getText().toString() + "\", \"UserID\":\""
+ user + "\" } " ;
At server, error: There was an error deserializing the obje开发者_开发知识库ct of type Pest. Encountered invalid character ' '.
How to encode?
try passing in the NO_WRAP
flag to the Base64 encoder. the JSON deserializer might be choking on unescaped newlines within the string.
精彩评论