0
4

1 回答 1

7

Browsers will send the data in same encoding as you declared to page to be. For a sanity test, run this page:

<?php
header("Content-Type:text/html; charset=utf-8");
$file = basename(__FILE__);
if( isset( $_POST['data'] ) ) {
    echo $_POST['data'];
}
else {
    echo <<<HTML
        <form method="POST" action="$file">
            <input name="data" type="text">
            <input type="submit">
        </form>
HTML;
}

Write "äöä" to the form and see if it's right. If it isn't, try to check your mbstring ini values for:

<?php

var_dump(
    ini_get("mbstring.http_input"),
    ini_get("mbstring.http_output"),
    ini_get("mbstring.encoding_translation")
);

The correct values are:

string(4) "pass"
string(4) "pass"
string(1) "0"
于 2012-12-13T12:02:39.150 回答