special character issue

Discussion in 'PHP' started by shiva_rnm, May 23, 2010.

  1. #1
    Hi All,

    I've a issue with the special character in my title and description... am showing below my sample records from DB as array

    Array
    (
    [0] => Array
    (
    [identifier] => 6273
    [title] => djg dfghd dfgj &#61636_;sdf s sdf
    [description] => Pour ”les entreprises, &#333_; dans un climat de concurrence
    )

    [1] => Array
    (
    [identifier] => 6274
    [title] => tock options et bons de &#61636_;sdf s sdf
    [description] => our &#10146_;les entreprises, ōdans un œ climat de concurrence
    )
    etc...
    )

    here above in bold see some special characters are replaced with code like ō ...i've to replace all these with the real char in DB.
    i want to search particular string content &# till ; and replace with some valid char and also i do want to list them first by doing echo . how can do this with string operation?


    Thanks,

    Shiva
     
    shiva_rnm, May 23, 2010 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    before putting it in the array use mysql_real_escape_string()
     
    bartolay13, May 23, 2010 IP
  3. shiva_rnm

    shiva_rnm Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi , mysql_real_escape_string is not working :( ...anyone have another method to do it ..

    i've tried all thesee

    //$titleInput = htmlspecialchars_decode($rec['title'], ENT_NOQUOTES,"UTF-8");
    //$titleInput = htmlspecialchars(html_entity_decode($rec['title'], ENT_QUOTES, 'UTF-8'), ENT_NOQUOTES, 'UTF-8');
    //$titleInput = utf8_decode(html_entity_decode($rec['title']));
    //$titleInput = html_entity_decode($rec['title'], 'HTML-ENTITIES');
    //$titleInput = html_entity_decode($rec['title'], 'HTML-ENTITIES');
    //$titleInput = html_entity_decode($rec['title'], ENT_QUOTES);
    //$titleInput = iconv("ISO-8859-1","UTF-8",$rec['title']);
    //$titleInput = utf8_encode($rec['title']);

    //$string = mb_convert_encoding($rec['title'], $chr,'UTF-8');
    //foreach(mb_list_encodings() as $chr)
    //{
    // $string = mb_convert_encoding($rec['title'], $chr, 'ISO-8859-1');
    //}
    //$titleInput = html_entity_decode($rec['title'], ENT_NOQUOTES,"cp1252");
    //$titleInput = htmlentities($rec['title']);
     
    shiva_rnm, May 27, 2010 IP