java - How to know if my HTTP request uses UTF-8? -
i'm trying fix problem in android app. app posts http request web service. when text in request contains swedish characters Å, Å , Ö, doesn't work. people have web service it's because request has encoded in utf-8, , it's not.
the app uses org.apache.http.impl.client.defaulthttpclient, , assume line says utf-8 should used: httpprotocolparams.setcontentcharset(params, "utf-8");
i used wireshark see app sends, , string "teståäöÅÄÖéüà" shown as: "test\345\344\366\305\304\326\351\374\340"
i found out by table numbers octal representation of "unicode code point" characters. that's else utf-8, right?
is if utf-8, special characters represented 2 bytes, e.g. "c3 a5" "å" , "c3 a4" "ä"?
so:
1. understand right unicode vs utf-8?
2. right what's being sent not in utf-8-encoding?
3. how make defaulthttpclient send in utf-8?
jon
as pointed out stephen, must distinguish between encoding used in http header (for url) , request body.
anyway, distinction not between unicode vs utf-8 , utf-8 1 of charset encodings unicode (utf-16 another).
and not using unicode, aparently, old latin1 (iso 8859-1) : 1 byte each character. happens first 128 unicode codepoints coincide (roughly) positions used latin1.
do favour , read basics unicode, should take 1 or 2 days, it's valuable , necesary knowledge programmer today (and tomorrow) .
Comments
Post a Comment