I need to send a NSString to a PHP file that goes into a MySQL database. The problem that I have is with especial characters like "é". When I get the string (from the Facebook SDK for iOS) it comes like this: "Thenáme Thesurnamé", for example.
I send it to a PHP on a server using unicode as charset (I also tried with utf8), but in the database it appears with "é" instead of "é".
The encoding of the database is utf8_unicode_ci
您始终可以在html中使用“ &”号来编码此类字符。
试试这个代码:
NSString *resStr = [[NSString alloc] initWithCString:[srcStr cStringUsingEncoding:[NSString defaultCStringEncoding]] encoding:NSMacOSRomanStringEncoding];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.