Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] [OT]: PHP/MySQL: Japanese input/ouput prgramming advicedocs sought



> Can anyone point me to any references, tutorials, links, that I can 
> read in order to best plan ahead? Even basic things like how to 
> receive japanese data into PHP or inputting/retrieving/sorting 
> japanese into MySQL are a mystery to me. 

I'm not sure about how MySQL handles Japanese text (although I've heard 
it supposedly can do it; never tried), but for PHP, you might have to 
recompile it and/or Apache (depending on how you build PHP and Apache). 
 There's something called an mbstring functions that allow you to 
convert between character sets and I believe you have to turn it on when 
you build PHP (I might be wrong here, but I do this whenever I build PHP 
with this feature).  I'm not sure of the exact option during the 
configuration process, but that should get you started.  The page that 
describes this information is located at:

http://www.php.net/manual/en/ref.mbstring.php

It'll describe what is and isn't supported and how to handle basic 
input/output functions.

I don't want to start up a religious war here on postgres vs mysql, but 
have you considered using Postgres for this?  I know that postgres has 
some pretty good support for multibyte character encodings including 
UTF-8 and EUC-JP, both of which are supported in php.  Again, i'm not 
100% sure about collation issues (e.g. sorting) but I'm going to assume 
that because of it's support, you probably can get away with this 
feature in Postgres.  Just in case, usually, the way I build this into 
postgres is:

./configure --prefix=/usr/local/pgsql --enable-locale 
--enable-multibyte=UNICODE
make
make install

multibyte can be changed to other encodings that start as default like 
EUC-JP.

additionally, I do the following to finish the setup/installation of 
postgres:

adduser pgsql
mkdir /usr/local/pgsql/data
chown pgsql /usr/local/pgsql/data
su - pgsql
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data -S&

then if i need to create a database with the unicode/UTF-8 encoding I 
just do this:

createdb -U someuser -W -E UNICODE -e somedb

Next, entering the data is the same in terms of going between php and 
the database, EXCEPT, that you need to do the string conversions prior 
to interacting with the data.  I think that should be enough to get you 
started.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links