Mailing List Archive

Support open source code!


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

Re: Web forms and Japanese



Josh,

At my last job we used Chinese in PHP3 and MySQL with few 
problems. We used a meta tag for the character set 
(Big5, which is a lot like SJIS). 

For MySQL, we just used it in ISO-8859-1 mode.
The major effect of language in MySQL is for sorting, which
is not particularly interesting for Chinese, as long as it's
consistent. 

One area where you may run into problems is with "embedded"
characters that have meaning in either HTML or SQL. For
example, the second byte of a two-byte character may be
"<", which can cause problems with the browser. It is possible
to "escape" the symbols, replacing them with, e.g. "<", but
that makes them unreadable in some browsers. 

The IMP web mail client (http://www.horde.org/), which is written 
in PHP ran into some pretty serious troubles with this stuff,
particularly considering the requirement to handle "HTML mail". 
Last time I checked they were moving toward using UTF-8 (which
most modern browsers support) as the display encoding, as it
doesn't have any embedded characters. Any mails that came in
in other character sets would get converted to UTF-8 for display.

For SQL, the magic character to worry about is the single quote
character. We have had lots of fun with this in conjunction with
Perl. You may have similar issues with PHP. 

In perl, it is necessary to write all your SQL calls with replacable
parameters instead of building SQL statements dynamaically.
For example, 
    $dbh->prepare("SELECT foo FROM foo_table WHERE name = ?");
    $dbh->execute($name);
instead of
    $dbh->do("SELECT foo FROM foo_table WHERE name = $name");

Again, storing UTF-8 in the database might be useful here
too, depending on your application.

-Jake

--- Josh Glover <jmglov@example.com> wrote:
> Quoting Josh Glover <jmglov@example.com>:
> 
> > I am working on some research project in one of my
> > classes, [...]
> 
> I forgot to ask the all important question:
> 
> Does MySQL handle Japanese? I want to store the anketo data
> in MySQL...
> 
> 
> ---------------------------------------------------
> "No segfault, no problem."
> 
> Josh Glover
> jmglov@example.com
> ---------------------------------------------------
> 
>
-----------------------------------------------------------------------
> Next Technical Meeting:  Sat, May 12 13:30- 
> Next Nomikai Meeting:    Fri, June (TBA) 19:30- Tengu Tokyo Eki Mae
>
-----------------------------------------------------------------------
> more info: http://www.tlug.gr.jp           Sponsor: Global Online
> Japan
> 



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links