I have many tables like the table Person:below, in mysql database.

person_id, first_name,last_name, mi, gb_first_name, gb_last_name,
b5_first_name, b5_last_name, gender, dob

where different columns storing strings in different encodings.


All the strings/fields etc. need to be in the *same* encoding - UTF-8

Only UTF-8 can handle all languages.

At anytime, a web user can switch the language and the application will get
the values in the right columns to generate web pages. The purpose of
Multi-language tables is to make multilanguage dynamic content management
easier for web applications.  For example, to add a person record, the user
enter the English name, then switch the session language to gb2312,


gb2312 is an encoding - not a language.

enter the Chinese name in gb2312, and then switch the session language to
big5,


big5 is an encoding - not a language

enter the name in big5. And then commit the data into the database. The
whole thing sounds complicated but can be treated as a pattern and let a
framework to take care of those and the code can be as clean as a single
language app. I actually have the framework that works well for me with
mysql database.

I didn't do anything about language encoding in mysql database, it just
worked for me. At least with english, gb2312 and big5 altogether in a table
like table Person above. I noticed that (english, gb2312, big5, Jp) cannot
work together (where jp is any kind of japaness language encoding).  My
approach seems fine with most western languages

So after all such experimental work, I still don't know how to make a real
multi language web app such that the languages are switchable within the
same session.

Any suggestions?  Any web application known to be able to solve the
problem? Thanks


Everything needs to be in UTF-8.
- the database
- application logic
- and all web interfaces.

Forget about big5, gb2312, shift_jis etc!

Also, web forms submit content in the encoding of the web page. So make sure
your http content-type header is set to UTF-8 for all web pages.

I'm not sure what technology you're using - php/java etc?
By default, most web servers/applications serve content as
ISO-8859-1encoding - which only works for western European languages. -
unless you specifically tell it otherwise.

In a JSP for example, you need to put this directive at the top of a page:
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>


This article is useful -
http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/index.html
even if you're not using Java technology.

~mm

Reply via email to