> When I try copying and
> pasting it into the mysql client command-line, the data gets trashed.

Not necessarily. May just be that the command-line window doesn't know
to display Chinese unless you tell it to. What OS are you working on?

>  For example, how do I insert the Chinese text from my source (a Word
> doc) into a MySQL table without corrupting it?

Well, pasting it into the command-line window is okay if it's not a lot
of data, but if it is a lot you probably want to save it as
(tab-delimited?) text and import it. See the MySQL manual, sec. 6.4.9:

    http://www.mysql.com/doc/en/LOAD_DATA.html

> Once it's in, how do I get it back out into my application without
> corrupting it? I'm using PHP 4.3 for the Web site.

The problem is less one of corrupting the text and more one of making
sure whatever is getting the output know to display it as Chinese.

However, concerning corrupting the text, you need to be aware of the
escape character and three other special characters and treat them
special:

    http://www.mysql.com/doc/en/String_syntax.html

That's section 6.1.1.1 of the manual. The four characters are backslash,
NUL, single quote, and double quote. If you're using BIG-5 and grabbing
it a byte at a time, you'll need to treat both bytes as if they were
single-byte characters, escaping those bytes whose values match the
four special characters (0x5c, 0x00, 0x27, 0x22, I think).

There aren't many of those, but they do show up sometimes.

> If I need to make changes to the data from the command-line client, how
> can I do it, especially if the query involves using a Chinese-language
> string? For example, "update langdata set
> menutitle='SOME_MENU_TITLE_IN_CHINESE' where
> menutitle='SOME_OLD_MENU_TITLE_IN_CHINESE'

Well, like I said. You need to make sure your command-line shell can
talk to you in Chinese before you do that, or you won't be able to see
what you're doing.

If you're in MSW2k, you should be able to set up a new user account and
set that account up to default to Chinese. Maybe. I do this with
Japanese and it works. 

If you're in Mac OS X, you can also simply tell the system to give you
Chinese in addition to your main language. Unfortunately, Mac OS X's
shell windows don't fully deal with extended character sets yet, so you
may find it preferable to use tab-delimited text files. (You may also be
able to find command-line shell applications that work reasonably well
with Chinese.) 

Linux or BSD will require special setup that's beyond my ability to
explain in a post to this newsgroup. There are pages on the web that
explain how, I think.

> Looked at the online manual but am sorry to say it didn't really help much.
> I tried starting the server with --character-set=big5 but it didn't seem to
> make much difference...

MySQL has to work inside your system, so your system also has to know
what character set you're going to use. Likewise, you'll have to tell
people's browsers it's Chinese. And if you're using Big-5 with Java,
you'll have to tell Java to convert between Unicode and BIG-5.

HTH

-- 
Joel Rees, programmer, Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to