Reputation: 1881
I'm building an iOS app which among other things, sends data to a PHP server.
I have problems with accented characters like in the string jeremyö
which when sent from:
string(7) "jeremyö"
string(8) "jeremyö"
When used as a login, this breaks all my stuff.
Do you have any hint on how I can work around this behavior?
PHP part is UTF-8 only (Drupal 7 backend), and I don't know the encoding used on iOS, but I guess it's UTF-8 or maybe UTF-16.
Thanks, Jérémy
Upvotes: 2
Views: 288
Reputation: 84132
This sounds more like unicode canonicalization then encoding. In unicode a character like ö can be represented in two ways. It can be U+00F6
(small o with diaeresis) or it can be two characters: a normal o and a combining diaeresis (U+0308).
On iOS there are methods such as NSString's precomposedStringWithCanonicalMapping
, decomposedStringWithCanonicalMapping
etc that allow you to convert strings between these various representations, there are probably similar methods in php.
If you are using these strings as query parameters to your database then your database probably has settings that control what string equality means (for mysql it's the collation property)
Upvotes: 1