Inserting a UTF-8 NSString in MySQL with PHP -


i have objective-c nsstring (say, 'gabriel garcía márquez') want pass php via post request, in turn call mysql insert add string utf8-bin column. trouble is, string shapeshifting along way, , i've read every stack overflow post on subject prevent it.

the post request (with charset utf-8) contains 'gabriel garc\u00eda m\u00e1rquez'.

if insert string utf8-bin column right away without encode or decode, result in mysql '4761627269656c2047617263c3ad614dc3a1727175657a'. if wrap string in utf8_decode(), result 'gabriel garc'. if wrap string in utf8_encode() (hey, why not?), result same first string.

what missing prevent text devolving garbage?

some notes make more frustrating:

  • i call mysql_set_charset('utf8', $conn) before insert query.
  • the table collated in utf8_bin, columns utf8_bin.

oops...it's phpmyadmin bug. '4761627269656c2047617263c3ad614dc3a1727175657a' is, surprisingly, correct in different environment -- prints readably in, say, mysql workbench. took me 2 days figure out...


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -