Re: Searching MySQL with Japanese chars
| From: | Eric Butera | Date: | Fri, 17 Oct 2008 12:59:07 +0000 |
| Subject: | Re: Searching MySQL with Japanese chars | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282031@lists.php.net to get a copy of this message | ||
On Fri, Oct 17, 2008 at 8:22 AM, robert mena <robert.mena@gmail.com> wrote:
> Hi,
> I am developing my first application that will have to handle with japanese
> data stored in a MySQL database. After digging a while it seems that I'd
> have to set all pieces (from the charset of the apache, to the encoding of
> the templates and database fields) set to UTF-8.
>
> I'd like to know if there is something special that I have to be aware when
> doing searches. I am not sure that this is more related to PHP or MySQL
> itself so before sending to them (MySQL list) I'd like to hear from you.
>
> Thanks.
>
Make sure your character collation is utf also as that is exactly what
it's for. You might need to use something like mysql_set_charset().
You'll need something like this also:
header('Content-Type: text/html; charset=utf-8');
The reason I say this is because however you put your data in is how
you need to search on it. So if you inject utf8 into a latin1 db
you're going to have a hard time in the future. Other than that
everything else should just work fine.