php - json_encode / decode char troubles -
i'm having troubles json_encode/decode functions when store string mysql db table. problem in swedish chars, ÅÄÖ. if have like
$my_arr = array('räksmörgås'); $json = json_encode($my_arr): print_r(json_decode($json));
it works fine, trouble is, said, when store jsonstring db , collects them. table (entire db) has encoding 'utf8_general_ci'. i've tried uft8_unicode_ci' well, same result, output 'ru00e4ksmu00f6rgu00e5s
'. column store valus 'text'.
what doing wrong?
edit, forgot mention plugin wordpress , i'm using $wpdb->prepare() , $wpdb->query().
somewhere in code stripping slashes.
// text: räksmörgås // json_encode(): r\u00e4ksm\u00f6rg\u00e5s // output: ru00e4ksmu00f6rgu00e5s
Comments
Post a Comment