I am trying to replace an apostrophe (') with a sharp (') from a string after it has been entered into the form and submitted it.
<?= str_replace("'","´",$_POST['string']) ?>
For example, the line
: "Jan Motel"> should become "Jan's Motel"
This works well when using charset iso-8859-1, but I need my site to be in utf-8.
I utf-8, result line - "Janâ's Motel"
I do not understand why it becomes "Â" instead of ""
Here is my sample code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>notitle</title> </head> <body> <form action="?" method="post"> <input type="text" name="string" value="<?= str_replace("'","´",$_POST['name']) ?>" /> </form> </body> </html>
Can anybody help?
source share