Re: utf-8 in $_POST
| From: | mike | Date: | Mon, 07 Jan 2008 20:52:29 +0000 |
| Subject: | Re: utf-8 in $_POST | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266854@lists.php.net to get a copy of this message | ||
maybe look at iconv functions
but the <meta> content-type is the only thing i set, and it works 100%
fine. all javascripts, forms, etc. inherit it from the looks of it
properly.
On 1/7/08, Olav Mørkrid <olav.morkrid@gmail.com> wrote:
> i specify iso-8859-1 in both header and body:
>
> <meta http-equiv="Content-type" content="text/html;
> charset=iso-8859-1"/>
> <form action="/" method="post" accept-charset="iso-8859-1">
>
> if two different people post the norwegian phrase "Godt nytt år"
> (happy new year), it may appear in the following variations:
>
> [CONTENT_TYPE] => application/x-www-form-urlencoded;charset=iso-8859-1
> $_POST["input"] = "Godt nytt år"
>
> [CONTENT_TYPE] => application/x-www-form-urlencoded;charset=utf-8
> $_POST["input"] = "Godt nytt år"
>
> i was just wondering if php had some setting or function that would
> make it auto-convert $_POST data into one specific encoding. otherwise
> i seem forced to do something like this in the beginning of my php
> script:
>
> if(ereg("utf-8", $_SERVER["CONTENT_TYPE"])) {
> foreach($_POST as $key => $value)
> $_POST["key"] = convert_utf8_to_iso8859($value);
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>