|
From: Jesse L. <jes...@gm...> - 2006-07-06 08:44:53
|
Slash Chinese UTF-8 Change List
Note: This change list is based on Slash CVS T_2_5_0_112 (2006/5) and
MySQL 4.1.x.
1, MySQL Server
We are using MySQL 4.1.12, if you use the version of MySQL below 4.1,
e.g. 4.0.x, some configurations are different.
1). In my.cnf(In /etc/mysql/my.cnf or /etc/my.cnf), add such a line
'default-character-set = utf8' below [mysqld]. This will tell MySQL
use UTF-8 charset.
2). Before install slash, set your database's collation as
'utf8_general_ci'. Or add this sentence 'DEFAULT CHARSET=utf8' after
'ENGINE=InnoDB' at the end of every table in the SQL file. These two
ways are same effect. This step will let Slash database use UTF-8.
3). Create a new mysql config file for Slash, e.g. 'my.cnf'. The
content of this my.cnf is:
[client]
host = localhost
port = 3306
database = dbname
user = mysqlusername
password = yourpassword
default-character-set = utf8
We put it in /usr/local/slash folder. Then edit 'dbix-password.conf'
( /etc/dbix-password.conf), add such a line of setting:
'solidot':'':'':'':'':'DBI:mysql:solidot;mysql_read_default_file=/usr/local/slash/my.cnf':'mysql':'localhost'
This step will make the connection between Slash and MySQL to use
UTF-8. No this step, the web page will display mess character in
Chinese.
2. Code and Backslash
1). Delete all the filters in Backslash (Admin Panel). Those filters
will prevent story submission and posting comment in Chinese.
2). Vars -> draconian_charset set to '0'.
3). /htdocs/comments.pl line 718:
Can't submit comment in Chinese.
Original: if ($d !~ /\w/) { # require SOME non-whitespace
Change to: if ($d =~ /^\s*$/) { # require SOME non-whitespace.
4). Utility/Data/Data.pm line 1566:
Original: | (?!$nbe)\S # or an ordinary char
Change to: | (?!$nbe)(?!\s)[\x00-\x7F] # or an ordinary char
The original code can make longer Chinese sentence to display some "??????".
5). to solve Recent Journal Story on the right side bar display mess
Chinese Character.
Utility/Data/Data.pm line 3484:
Original: $text =~ s/([^\s\040-\176])/ "&#" . ord($1) . ";" /ge;
Change to: $text =~ s/([^\s\040-\377])/ "&#" . ord($1) . ";" /ge;
Backslash: vars -> rdfencoding, change the value to 'UTF-8'.
The above is only the part, not the total. But these sovled some main
problems contain database encoding and Chinese displaying and posting.
There are others such as date display format, button text shane
mentioned yesterday, etc. I will continue to reinforce.
|