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
  • 87
  • 7

3 Answers3

0

While saving the form use:

utf8_encode($_POST['fieldname'])

While showing the form value:

utf8_decode($_POST['fieldname'])
Thomas Orlita
  • 1,448
  • 14
  • 27
Alpesh Panchal
  • 1,687
  • 11
  • 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
  • 143
  • 1
  • 6
-1

Try replacing the special chars like this:

http://www.w3schools.com/charsets/ref_html_ansi.asp

Chris G
  • 785
  • 6
  • 20
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – greg-449 Dec 26 '15 at 17:21