Android JSON Rails parsing problem
In my Android ap开发者_JAVA百科plication I've try to send Cyrillic text in JSON to Rails but got error
StandardError (Invalid JSON string: '{"from_address":". , 4","from_location":{"lat":55.13718833333334,"lng":61.40910333333333},"authentication_token":"487884511081085287658949531157857112691099771"}'):
Has anyone faced that?
You probably need to correctly set the Content-Type
header in the POST request to include the proper charset. Something like this:
Content-Type: application/json ; charset=UTF-8
Obviously this works if you are using UTF-8: change the charset to whatever you are actually using in the Android client.
精彩评论