开发者

Android JSON Rails parsing problem

开发者 https://www.devze.com 2023-03-26 05:54 出处:网络
In my Android ap开发者_JAVA百科plication I\'ve try to send Cyrillic text in JSON to Rails but got error

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号