I am working on application in which I need to pass all the data send to server via json array at exact user had passed.
But My problem is When I pass Single quote message doesn't send to server.
I had tried.
text=text.replaceAll("'","\'");
Please give solution for that.
Change your replaceAll("'","\'"); to replaceAll("'","\\u0027");
EDIT:
\u0027 is the unicode representation of '. Except in rare cases, unicode representations can be used in place of troublesome characters like ',",@,?, and &.
You are likely losing your single quote characters because your json is going through multiple layers of serialization/deserialization that are outside your control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With