I have a UITextView
which I call messageField
. The data within that messageField
is POST
-ed to server in JSON format. When th
I had the same problem, after digging for hours and finally found this answer that works for me: https://stackoverflow.com/a/8339255/1090945
If you are using rails as your server, this is all you need to do. No need to do anything in ios/xcode, just pass the NSString without doing any UTF8/16 encoding stuff to the server.
Postegre stores the code correctly, it's just when you send the json response back to your ios client, assuming you do render json:@message, the json encoding has problem.
you could test whether you are having json encoding problem in your rails console by doing as simple test:
test = {"smiley"=>"u{1f604}"} test.to_json
if it prints out "{\"smiley\":\"\uf604\"}" (notice the 1 is lost), then you have this problem. and the patch from the link will fix it.