special characters in firefox

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
helpercenter
Forum Newbie
Posts: 5
Joined: Sat Feb 09, 2008 5:09 pm

special characters in firefox

Post by helpercenter »

hi!

so I have made a simple form, which can send a name like "Frédéric" to the same php file.

If I try to get the value with $_GET or $_REQUEST, I get "Frédéric" but if I apply htmlentities($name), it puts me out :Frédéric

whats wrong with it ?

I tried already to apply html_entity_decode before putting it out, but the result did not change!

thank you!
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: special characters in firefox

Post by yacahuma »

that does not happens to me. Could you paste your code? Try to just pust the smallest working sample. The following printed exactly what I put in the text. inclusing latin characters.

Code: Select all

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page title</title>
</head>
<body>
<form action="#" method="post">
Data: <input type="text" name="name" />
<input type="submit" />
</form>
<?
echo htmlentities($_POST['name']);
?>
</body>
</html>
helpercenter
Forum Newbie
Posts: 5
Joined: Sat Feb 09, 2008 5:09 pm

Re: special characters in firefox

Post by helpercenter »

hi !

thank you for your reply.

I used now following code and it worked. Do you know another idea ?

Code: Select all

$yourname       = htmlentities(trim($yourname),ENT_QUOTES,'utf-8');
thank you
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: special characters in firefox

Post by yacahuma »

try this

Code: Select all

 
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>    
</head>
 
http://www.webheadstart.org/xhtml/encoding/
Post Reply