Re: utf-8 in $_POST

From: Date: Mon, 07 Jan 2008 16:52:17 +0000
Subject: Re: utf-8 in $_POST
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-266844@lists.php.net to get a copy of this message
> <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1"> > > My experience is that this does not affect only the displayed > characters, but the way the form fields are transported. > > But perhaps I am wrong, > Iv This works for me as well. Put in utf-8 and you should be good to go. You don't -technically- need to even change your database fields or anything; MySQL will take the utf-8 content and treat it like normal binary content. (However, if you want to modify the data in MySQL, then you might want to make sure you have all the right character sets and stuff...) I've had 100% success with just inserting and selecting info back and forth from MySQL and displaying it on the page, with the proper <meta> tag. Works like a charm in all languages attempted - English, Chinese (both Simplified and Traditional), Russian, etc... it will look funky if you view it directly in MySQL command line client or if you forget the utf-8 tag though (unless your TERM + column and connection is set properly)

« previous php.general (#266844) next »