City-of-Bloomington / open311-android

GeoReporter Android source code. Native Android smartphone client app for Open311 API civic issue reporting.
http://open311.org
Other
31 stars 36 forks source link

Special characters sent wrongly and Content-type header missing #70

Closed Jaakko closed 11 years ago

Jaakko commented 11 years ago

I've been testing Georeporter with special characters like scandinavian "äöå" . It seems that this needs some fixing for both form-encoded and multipart posting.

As part of the testing I noticed the app doesn't seem to send any Content-type header, e.g. "Content-Type: application/x-www-form-urlencoded". I've tried to include with "request.setHeader("Content-type", "application/x-www-form-urlencoded; charset=utf-8");" without luck. I don't know why it's not including the header.

Anyway, when I get this right I will send an pull request.

Jaakko commented 11 years ago

I have to add that I doubt that "Content-Type: application/x-www-form-urlencoded" is not sent. Somehow I just cannot see it on my dummy PHP server.

inghamn commented 11 years ago

The Content-Type header should be set correctly by the Apache HTTP library we are using. In Open311.java, the prepareMultipartEntity returns a MultipartEntity from the httpclient library. At the end of that function, before we return, you should be able to send print the POST to the Android log. This would confirm the headers are being sent as expected.

It might also show if the characters are already garbled in the POST before being sent.

Jaakko commented 11 years ago

Now this is corrected.