1

I have a html form, into a php script (in a php file)

the form title, the field title, and so on, are showing well but the content which is introduced by the user into the form, when it has "á, é, í, ó, ú" or "ñ" the output of the script, converts these characters into "??"

I have set

<meta charset="utf-8" /> 

and

header('Content-Type: text/html; charset=utf-8');

in all the files involving the form (also the character allowed into the form) and the action url also has that config.

but, my special chars still are converted to "??"

any clue? thanks

EDIT: files are encoding in utf8 also tried in utf8-without bom

EDIT 2:

my form is:

<form action="file.php" accept-charset="UTF-8" method="post">';
                <label>
                    <span>trailer</span>
                    <input  type="text" name="calidad">
                </label>
                <label>
                    <span>Mediainfo (requerido)</span>
                    <textarea name="mediainfo"></textarea>
                </label>

            <input type="hidden" name="board" id="board" value=' .  $foro . '>

                <label>
                    <span>info</span>
                    <input placeholder="" type="text" name="info" tabindex="3" required>
                </label>

            <input class="botonsubmit" type="submit" value="Postear" name="sub2">
</form>

file.php only uses

$mediainfo = request_var('mediainfo','');

then i echo that variable.

uchi
  • 99
  • 9

2 Answers2

0

While saving the form use:

utf8_encode($_POST['fieldname'])

While showing the form value:

utf8_decode($_POST['fieldname'])
Thomas Orlita
  • 1,554
  • 14
  • 28
Alpesh Panchal
  • 1,723
  • 12
  • 9
0

You have to change The apache server conf too In httpd.conf add (or change if it's already there):

AddDefaultCharset utf-8
Moataz Eisa
  • 153
  • 1
  • 6