Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 Below you have the configuration for UTF-8. Note that this is valid for XWiki 1.0 b5 and above. Easier configuration might be provided for upcoming releases.
6
7 = XWiki encoding =
8
9 Change the charset enconding in these XWiki files:
10
11 * **web.xml**: locate the filter class ##com.xpn.xwiki.web.SetCharacterEncodingFilter## and change it to UTF-8. It should look like this:
12 (((
13 {{code language="xml"}}
14 <filter>
15 <filter-name>Set Character Encoding</filter-name>
16 <filter-class>com.xpn.xwiki.web.SetCharacterEncodingFilter</filter-class>
17 <init-param>
18 <param-name>encoding</param-name>
19 <param-value>UTF-8</param-value>
20 </init-param>
21 </filter>
22 {{/code}}
23 )))
24 * **xwiki.cfg** : locate the line containing ##xwiki.encoding## and change it to look like this:
25 (((
26 {{code}}
27 xwiki.encoding = UTF-8
28 {{/code}}
29 )))
30
31 = HTML encoding =
32
33 Change the HTML encoding in XWiki through Administration ~-~-> Preferences ~-~-> Presentation ~-~-> HTTP Meta information.
34
35 {{warning}}
36 This is Administration ~--> Presentation then look for Header ~--> HTTP Meta Information in more recent XWiki default wikis
37 {{/warning}}
38
39 Inside this textbox locate the **Content-type** meta tag and make it look like this, changing the encoding to UTF-8
40
41 {{code language="xml"}}
42 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
43 {{/code}}
44
45 {{warning}}
46 This step is not needed if you have the following. Instead that line can be left alone.
47 {{/warning}}
48
49 {{code language="xml"}}
50 <meta http-equiv="Content-Type" content="text/html; charset=$!xwiki.encoding" />
51 {{/code}}
52
53 = Hibernate configuration =
54
55 Add the following lines in the ##hibernate.cfg.xml## file:
56
57 {{code language="xml"}}
58 <property name="connection.useUnicode">true</property>
59 <property name="connection.characterEncoding">UTF-8</property>
60 {{/code}}
61
62 = MySQL configuration =
63
64 It's common practice that the MySQL configuration file, in *nix systems is located in $$/etc/mysql/my.cnf##:
65
66 {{code}}
67 [client]
68 default-character-set=utf8
69 [mysqld]
70 default-character-set=utf8
71 character-set-server = utf8
72 collation-server = utf8_bin
73 {{/code}}
74
75 = Servlet Container =
76
77 == Jetty ==
78
79 {{code}}echo off
80 rem set LANG=fr_FR.ISO8859-1
81 set LANG=en_US.UTF-8
82 set JETTY_PORT=8080
83 set JETTY_HOME=.
84 java %JAVA_OPTS% -Djetty.port=%JETTY_PORT% -Djetty.home=%JETTY_HOME% -Dfile.encoding=UTF-8 -jar %JETTY_HOME%/start.jar
85 {{/code}}
86
87 Instead of the config system variable LANG you can use JVM properties.
88
89 {{code}}
90 -Duser.language=en
91 -Duser.country=US
92 {{/code}}
93
94 in server startup script.
95
96 == Tomcat ==
97
98 In order to enable UTF-8 in tomcat, you have to add
99
100 {{code}}
101 URIEncoding="UTF-8"
102 {{/code}}
103
104 to each connector enabled/used in ##conf/server.xml##. For example the non-SSL HTTP Connector should read:
105
106 {{code language="xml"}}
107 <Connector port="8080" maxHttpHeaderSize="8192"
108 maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
109 enableLookups="false" redirectPort="8443" acceptCount="100"
110 connectionTimeout="20000" disableUploadTimeout="true"
111 URIEncoding="UTF-8"/>
112 {{/code}}
113
114 {{warning}}
115 In case you're using AJP to connect Tomcat and httpd, make sure you add this attribute to the AJP connector.
116 {{/warning}}
117
118 == [[Glassfish>>http://glassfish.java.net/]] ==
119
120 To run XWiki with UTF-8 in Glassfish you will need to recreate the **xwiki-enterprise.war** file and do a change to the glassfish config. First, in the Administration GUI under Domain => General => Locale enter **en_US.UTF-8**.
121
122 Now you will need to add all the aforementioned changes from this document to the files in the war file, create a new warfile, and deploy that one to your glassfish installation. This is required due to the fact that Glassfish will not accept changes to a deployed web.xml file. So you need to deploy a ready changed **web.xml** file inside your war file because all subsequent changes to the deployed **web.xml** file in the filesystem are totally ignored.
123
124 Create a new directory that we will use as a temporary place to edit our war file:
125
126 {{code}}
127 mkdir xwikitmp
128 {{/code}}
129
130 Unpack the warfile:
131
132 {{code}}
133 cd xwikitemp;jar xvf ../xwiki-enterprise-web-1.5.war
134 {{/code}}
135
136 Edit the files as mentioned in the beginning of this article:
137
138 * wiki.cfg
139 * web.xml
140 * hibernate.cfg.xml
141
142 Now let's create a new warfile which contains all the changes:
143
144 {{code}}
145 jar cvf ../xwiki-enterprise-web-local-1.5.war .
146 {{/code}}
147
148 Now you can deploy your new .war file to Glassfish and it will have all the changes in it and wll be correctly deployed.
149
150 = System config =
151
152 Add the following variables to your system:
153
154 {{code}}
155 LANG = en_US.UTF-8
156 {{/code}}
157
158 [[Credits>>http://markmail.org/message/qitvntzz7cwpyo2w]]
159
160 = OpenOffice import =
161
162 If OpenOffice import turns characters into question marks or HTML Entity you need to edit **registrymodifications.xcu** located in user profile used by the OO server by adding:
163
164 {{code}}
165 <item
166 oor:path="/org.openoffice.Office.Common/Filter/HTML/Export"><prop
167 oor:name="Encoding" oor:op="fuse"><value>76</value></prop></item>
168 {{/code}}
169
170 [[Credits>>http://lists.xwiki.org/pipermail/users/2011-November/021004.html]]

Get Connected