0

I've this string in iOS app

Cat

then i pass this string in a POST request as parameter, but before i did:

NSString *nNick = [_stringNick stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

Now in PHP I get:

Cat%F0%9F%90%BC

The problem is in mysql database there is a record with this string:

CatðŸ¼

Now if I pass the string in php without stringByAddingPercentEscapesUsingEncoding there is no issue.

But in this case select * from table where nick = 'Cat%F0%9F%90%BC' return zero result.

How can I solve this issue without make an update to iOS app?

Thanks

Ilario
  • 5,979
  • 2
  • 32
  • 46
  • Check this link [How to insert utf-8 mb4 character(emoji in ios5) in mysql?](http://stackoverflow.com/a/8109948/7677598) – abdullahselek Mar 09 '17 at 10:51

1 Answers1

1

You need to set your mysql table encoding to utf8mb4

Bader
  • 825
  • 1
  • 9
  • 26
  • This is hard to answer it depends on your content and especially the language incase it's English you shouldn't worry but I think old emoji records you won't be able to render it probably – Bader Mar 09 '17 at 10:55
  • but without adding percent escape in iOS, the mysql query work well – Ilario Mar 09 '17 at 10:56
  • Try to test your database in localhost and see whats works for you – Bader Mar 09 '17 at 10:57