French characters...

Discussion in 'PHP' started by redhits, Jun 1, 2009.

  1. #1
    How to take care of this ...

    $tradus=str_replace('ă','a',$tradus);
    $tradus=str_replace('î','i',$tradus);
    $tradus=str_replace('é','e',$tradus);
    $tradus=str_replace('ô','o',$tradus);



    ?! its not working this way ... and i need to make the text ASCII compatible 100%
     
    redhits, Jun 1, 2009 IP
  2. Ralle

    Ralle Active Member

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #2
    What do you want?
    Do you want to remove the letters or even better, get them to display properly?
     
    Ralle, Jun 1, 2009 IP
  3. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #3
    I don't know if this helps..

    $search_array = array("ă", "î", "é", "ô");
    $replace_array = array("a", "i", "e", "o");
    $tradus = str_replace($search_array, $replace_array, $tradus);
     
    Kaizoku, Jun 1, 2009 IP
  4. Ralle

    Ralle Active Member

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #4
    It's the same, it's just less lines.
     
    Ralle, Jun 2, 2009 IP
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    The point is - WHAT is not working?

    The str_replace-items posted in the original post should work just fine, if the characters are in the text. So... what isn't working?
     
    PoPSiCLe, Jun 2, 2009 IP
  6. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #6
    it's not replacing the characters

    try it
     
    redhits, Jun 3, 2009 IP
  7. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #7
    Yes, it does. Although I didn't have that first char, the ă when I copied the text to my Notepad++ (guess it's not in the charset I use).

    But, however, this code:
    
    <?php
    $tradus = "înteresting, éxperiment, ôverwhelming";
    
    $tradus=str_replace('a','a',$tradus);
    $tradus=str_replace('î','i',$tradus);
    $tradus=str_replace('é','e',$tradus);
    $tradus=str_replace('ô','o',$tradus);
    
    echo $tradus;
    ?>
    
    PHP:
    gives this result:
    interesting, experiment, overwhelming

    so it is working just fine.
     
    PoPSiCLe, Jun 3, 2009 IP