json - Converting encoded chars back to original character - PHP -


my database returns following json special chars. need convert original chars:

{   "event_id":"5153",       "name":"event test",       "description":"persönlichkeit universität"",       "start_time":"2013-04-24 9:00 est",         "end_time":"2013-04-24 5:00 pm est"   } 

i want strip out html chars. , convert chars &ouml original chars. description in above json should this

persönlichkeit universität"

i doing array_walk on array before encoding array json, , strip_tags on each element. fine. (that resulted in above json.).

to chars back, tried:

  1. encoding again utf8_encode   2. htmlspecialchars_decode   3. html_entity_decode  //this 1 eliminating character altogether. 

but nothing gave original char back.

any ideas?

update:

i tried this. description field returns null

    array_walk_recursive($results, function (&$val) {     $val = strip_tags(html_entity_decode($val)); });  $results = json_encode( $results); 

html_entity_decode should trick. think problem somewhere else. remember json_encode accepts utf-8 characters. maybe have utf8_encode string.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -