Replace some Special Characters in a String

Discussion in 'PHP' started by mydigip, Jul 9, 2010.

  1. #1
    I have a special character that I want to replace from a string.
    The character is Å¡ and i want to replace with s but I didn't managed to do this with this particular php file. It is actually encoded utf-8 .

    Please help me this is becoming a nightmare.:confused:
     
    mydigip, Jul 9, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    
    $string = $content; //or some other variable
    $content = str_replace("Å¡", "s", $content);
    echo $content;
    
    PHP:
     
    MyVodaFone, Jul 9, 2010 IP
  3. mydigip

    mydigip Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes the problem is that id doesn't work!!
    :confused:
     
    mydigip, Jul 9, 2010 IP
  4. mydigip

    mydigip Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    EDIT: IT WORKS ! I CAN't BELIEVE BEFORE I USED $content = str_replace('Å¡', 's', $content); instead of " " and it didn't work, why?
     
    mydigip, Jul 9, 2010 IP