forked from SoylentNews/rehash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.utf8
126 lines (87 loc) · 4.15 KB
/
README.utf8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
UTF-8 slash is based on following software features:
* Unicode support in Perl (see perlunicode(1))
* MySQL Character Set Support
(see http://dev.mysql.com/doc/refman/5.0/en/charset.html)
For this we require:
perl >= 5.6
MySQL >= 5.6
perl module DBD::MySQL >= 4.026
perl module Cache::Memcached::Fast >= 0.22
Cache::Memcached has issues with utf8, thus it is no longer used for anything but memcached stats.
Cache::Memcached::Fast is used instead.
In case of creating new slash site
----------------------------------
Write your my.cnf (for DB servers) as below:
[mysqld]
character_set_client=utf8
character_set_server=utf8
collation_server=utf8_unicode_ci
Restart mysqld and check settings.
mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+-----------------+
| Variable_name | Value |
+--------------------------+-----------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+--------------------------+-----------------+
Change your DBIx::Password setting to reflect the need for utf8. When declaring $virtual set:
'attributes' => {mysql_enable_utf8 => 1},
as well as all the other settings necessary to connect to the database you are using.
Run "install-slashsite".
Set the following in the vars table of your new db:
content_type_webpage = text/html; charset=utf-8
rdfencoding = UTF-8
utf8 = 1
Ensure the following is set in your vhost config file:
AddType text/html;charset=utf-8 .shtml
Restart apache and slashd if they are running.
In case of changing existing slash site
---------------------------------------
Alter my.cnf settings as above in fresh install instructions.
[mysqld]
character_set_client=utf8
character_set_server=utf8
collation_server=utf8_unicode_ci
Restart mysqld and check settings.
mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+-----------------+
| Variable_name | Value |
+--------------------------+-----------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| collation_connection | utf8_unicode_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
+--------------------------+-----------------+
Alter each and every table. You could do this manually in the later dump but this is a lot quicker and will let you know if there are going to be issues. From a bash prompt:
for table in $(mysql -u YOURUSER YOURDB -N -e 'show tables;' | awk '{print $1}'); do echo ALTER TABLE $table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci\;>>temp.sql; done; mysql -u YOURUSER YOURDB <temp.sql
You can then rm temp.sql unless there were errors and you need to address them.
Now dump, drop, and reimport your database.
mysqldump -u USER -p YOURDB >./YOURDB.sql
mysql -u USER -p -e 'DROP DATABASE YOURDB;'
mysql -u USER -p -e 'CREATE DATABASE YOURDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;'
mysql -u USER -p YOURDB <./YOURDB.sql
Change your DBIx::Password setting to reflect the need for utf8. When declaring $virtual set:
'attributes' => {mysql_enable_utf8 => 1},
Set the following in the vars table either through mysql or through the admin panel
content_type_webpage = text/html; charset=utf-8
rdfencoding = UTF-8
utf8 = 1
Change the following in your vhost config file:
AddType text/html;charset=iso-8859-1 .shtml
to
AddType text/html;charset=utf-8 .shtml
Restart apache and slashd.