My simple utf-form is as follows:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
<title>A UTF-8 form</title>
</head>
<body>
<form name=”utf-form” method=”post” action=”temp2.php”>
<INPUT TYPE=”text” NAME=”textbox1″ value=”<?php echo trim(htmlentities(stripslashes($_POST[‘textbox1’]))); ?>”>
</form>
</body>
</html>
After I submitted with something like “天主教”, this form returned with the textbox1 value as garbage characters, which is incorrect.
If I just use $_POST[‘textbox1’] without stripslashes() and htmlentities() and trim() then this form returned with the textbox1 value as “天主教”, which is correct.
I need to use stripslashes() and htmlentities() and trim() so how shall I overcome the limit or solve this utf-8 PHP problem please?
Thanks for any replies in advance!