question marks php html


question marks php html

我有一个html表单,转换成php脚本(在php文件中)

表单标题、字段标题等显示良好,但用户引入表单的内容,当脚本的输出为"á,é,í,ó,ú"或"ñ"时,会将这些字符转换为"??"

我已设置

<meta charset="utf-8" /> 

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

在所有涉及表单的文件中(还有表单中允许的字符),操作url也有该配置。

但是,我的特殊字符仍然被转换为"??"

有线索吗?感谢

编辑:文件在utf8中编码,也尝试在没有bom 的utf8

编辑2:

我的表格是:

<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仅使用

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

然后我回应这个变量。

您也必须更改apache服务器配置文件在httpd.conf中添加(或更改,如果已经存在):

AddDefaultCharset utf-8

保存表单时使用:

utf8_encode($_POST['fieldname'])

显示表单值时:

utf8_decode($_POST['fieldname'])