Changes for page Encoding

Last modified by Vincent Massol on 2020/06/25

<
From version < 11.10 >
edited by AC
on 2010/01/20
To version < 12.1 >
edited by Silvia Macovei
on 2010/03/03
>
Change comment: Document converted from syntax xwiki/1.0 to syntax xwiki/2.0

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.AC
1 +XWiki.SilviaRusu
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 1.0
1 +XWiki 2.0
Content
... ... @@ -1,14 +1,14 @@
1 -1 XWiki Character Encoding Configuration
1 += XWiki Character Encoding Configuration =
2 2  
3 3  Here is below 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.
4 4  
5 -1.1 XWiki encoding
5 +== XWiki encoding ==
6 6  
7 7  Change the charset enconding in these XWiki files :
8 8  
9 -* *web.xml*: locate the filter class com.xpn.xwiki.web.SetCharacterEncodingFilter and change it to UTF-8. It should look like this
9 +* **web.xml**: locate the filter class com.xpn.xwiki.web.SetCharacterEncodingFilter and change it to UTF-8. It should look like this
10 10  
11 -{code:xml}
11 +{{code language="xml"}}
12 12  <filter>
13 13   <filter-name>Set Character Encoding</filter-name>
14 14   <filter-class>com.xpn.xwiki.web.SetCharacterEncodingFilter</filter-class>
... ... @@ -17,40 +17,50 @@
17 17   <param-value>UTF-8</param-value>
18 18   </init-param>
19 19  </filter>
20 -{code}
20 +{{/code}}
21 21  
22 -* *xwiki.cfg* : locate the line containing xwiki.encoding and change it to look like this
23 -{code}
22 +* **xwiki.cfg** : locate the line containing xwiki.encoding and change it to look like this
23 +
24 +{{code}}
24 24  xwiki.encoding = UTF-8
25 -{code}
26 +{{/code}}
26 26  
27 -1.1 HTML encoding
28 +== HTML encoding ==
28 28  
29 -Change the HTML encoding in XWiki through Administration --> Preferences --> Presentation --> HTTP Meta information.
30 +Change the HTML encoding in XWiki through Administration ~-~-> Preferences ~-~-> Presentation ~-~-> HTTP Meta information.
30 30  
31 -#warning("This is Administration --> Presentation then look for Header --> HTTP Meta Information in more recent XWiki default wikis")
32 +{{warning}}
33 +This is Administration ~--> Presentation then look for Header ~--> HTTP Meta Information in more recent XWiki default wikis
34 +{{/warning}}
32 32  
33 -Inside this textbox locate the *Content-type* meta tag and make it look like this, changing the encoding to UTF-8
34 -{code:xml}
36 +Inside this textbox locate the **Content-type** meta tag and make it look like this, changing the encoding to UTF-8
37 +
38 +{{code language="xml"}}
35 35  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
36 -{code}
37 -#warning("This step is not needed if you have the following. Instead that line can be left alone.")
38 -{code:xml}
40 +{{/code}}
41 +
42 +{{warning}}
43 +This step is not needed if you have the following. Instead that line can be left alone.
44 +{{/warning}}
45 +
46 +{{code language="xml"}}
39 39  <meta http-equiv="Content-Type" content="text/html; charset=$!xwiki.encoding" />
40 -{code}
48 +{{/code}}
41 41  
50 +== Hibernate configuration ==
42 42  
43 -1.1 Hibernate configuration
44 -Add the following lines in the <tt>hibernate.cfg.xml</tt> file:
45 -{code:xml}
52 +Add the following lines in the ##hibernate.cfg.xml## file:
53 +
54 +{{code language="xml"}}
46 46  <property name="connection.useUnicode">true</property>
47 47  <property name="connection.characterEncoding">UTF-8</property>
48 -{code}
57 +{{/code}}
49 49  
50 -1.1 MySQL configuration
59 +== MySQL configuration ==
51 51  
52 -It's common practice that the MySQL configuration file, in \*nix systems is located in /etc/mysql/my.cnf
53 -{code}
61 +It's common practice that the MySQL configuration file, in *nix systems is located in /etc/mysql/my.cnf
62 +
63 +{{code}}
54 54  [client]
55 55  default-character-set=utf8
56 56  [mysqld]
... ... @@ -57,78 +57,89 @@
57 57  default-character-set=utf8
58 58  character-set-server = utf8
59 59  collation-server = utf8_general_ci
60 -{code}
70 +{{/code}}
61 61  
62 -1.1 Servlet Container
72 +== Servlet Container ==
63 63  
64 -1.1.1 Jetty
74 +=== Jetty ===
75 +
65 65  
66 -{code}
67 -echo off
77 +
78 +{{code}}echo off
68 68  rem set LANG=fr_FR.ISO8859-1
69 69  set LANG=en_US.UTF-8
70 70  set JETTY_PORT=8080
71 71  set JETTY_HOME=.
72 -java %JAVA_OPTS% -Djetty.port=%JETTY_PORT% -Djetty.home=%JETTY_HOME% -Dfile.encoding=UTF-8 -jar %JETTY_HOME%/start.jar
73 -{code}
74 -
83 +java %JAVA_OPTS% -Djetty.port=%JETTY_PORT% -Djetty.home=%JETTY_HOME% -Dfile.encoding=UTF-8 -jar %JETTY_HOME%/start.jar{{/code}}
75 75  Instead of config system variable LANG you can use JVM properties
76 76  
77 -{code}
86 +{{code}}
78 78  -Duser.language=en
79 79  -Duser.country=US
80 -{code}
89 +{{/code}}
81 81  
82 82  in server startup script.
83 83  
84 -1.1.1 Tomcat
93 +=== Tomcat ===
85 85  
86 86  In order to enable UTF-8 in tomcat, you have to add
87 87  
88 -{code}
97 +{{code}}
89 89  URIEncoding="UTF-8"
90 -{code}
99 +{{/code}}
91 91  
92 -to each connector enabled/used in *conf/server.xml*.
93 -For example the non-SSL HTTP Connector should read:
101 +to each connector enabled/used in **conf/server.xml**. For example the non-SSL HTTP Connector should read:
94 94  
95 -{code:xml}
103 +{{code language="xml"}}
96 96  <Connector port="8080" maxHttpHeaderSize="8192"
97 97   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
98 98   enableLookups="false" redirectPort="8443" acceptCount="100"
99 99   connectionTimeout="20000" disableUploadTimeout="true"
100 100   URIEncoding="UTF-8"/>
101 -{code}
102 -#warning("In case you're using AJP to connect Tomcat and httpd, make sure you add this attribute to the AJP connector.")
109 +{{/code}}
103 103  
104 -1.1.1 [Glassfish>http://www.glassfish.org/]
111 +{{warning}}
112 +In case you're using AJP to connect Tomcat and httpd, make sure you add this attribute to the AJP connector.
113 +{{/warning}}
105 105  
106 -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.
107 -First, in the Administration GUI under Domain => General => Locale enter en_US.UTF-8.
115 +=== [[Glassfish>>http://www.glassfish.org/]] ===
108 108  
109 -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
110 -to you glassfish installations. 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 becuase all subsequent changes to the deployed web.xml file in the filesystem are totally ignored.
117 +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.
111 111  
119 +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 you glassfish installations. 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 becuase all subsequent changes to the deployed web.xml file in the filesystem are totally ignored.
120 +
112 112  Create a new directory that we will use as a temporary place to edit our war file
113 -{code}mkdir xwikitmp{code}
122 +
123 +{{code}}
124 +mkdir xwikitmp
125 +{{/code}}
126 +
114 114  Unpack the warfile:
115 -{code} cd xwikitemp;jar xvf ../xwiki-enterprise-web-1.5.war{code}
128 +
129 +{{code}}
130 +cd xwikitemp;jar xvf ../xwiki-enterprise-web-1.5.war
131 +{{/code}}
132 +
116 116  Edit the files as mentioned in the beginning of this article:
134 +
117 117  * wiki.cfg
118 118  * web.xml
119 119  * hibernate.cfg.xml
138 +
120 120  Now lets create a new warfile which contains all the changes:
121 -{code}jar cvf ../xwiki-enterprise-web-local-1.5.war .{code}
122 122  
141 +{{code}}
142 +jar cvf ../xwiki-enterprise-web-local-1.5.war .
143 +{{/code}}
144 +
123 123  Now you can deploy your new .war file to Glassfish and it will have all the changes in it and wll be correctly deployed.
124 124  
147 +== System config ==
125 125  
126 -1.1 System config
127 -
128 128  Add the following variables to your system
129 129  
130 -{code}
151 +{{code}}
131 131  LANG = en_US.UTF-8
132 -{code}
153 +{{/code}}
133 133  
134 134  Credits: http://www.nabble.com/Re%3A-problem-with-Chinese-p9547507.html
XWiki.XWikiComments[0]
Comment
... ... @@ -1,1 +1,1 @@
1 -As i know $LANG must be "en_US.UTF-8" ? (wrong format)
1 +As i know {{velocity filter="none"}}{{html clean="false" wiki="true"}}$LANG{{/html}}{{/velocity}} must be "en_US.UTF-8" ? (wrong format)
XWiki.XWikiComments[1]
Comment
... ... @@ -1,3 +1,1 @@
1 -You're right, it has been corrected.
2 -BTW, anyone that can log-in to the wiki (free registration) can change it.
3 -No offense, please.
1 +You're right, it has been corrected. BTW, anyone that can log-in to the wiki (free registration) can change it. No offense, please.
XWiki.XWikiComments[2]
Comment
... ... @@ -1,8 +1,5 @@
1 -Is anything more than "default-character-set=utf8" needed under [mysqld] in /etc/my.cnf
2 -in order to get mysql working properly with UTF8? At least in my case, I think UTF-8 has been working correctly
3 -both without 'character-set-server = utf8' and 'collation-server = utf8_general_ci'
1 +Is anything more than "default-character-set=utf8" needed under [[mysqld]] in /etc/my.cnf in order to get mysql working properly with UTF8? At least in my case, I think UTF-8 has been working correctly both without 'character-set-server = utf8' and 'collation-server = utf8_general_ci'
4 4  
5 -I'm using "mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0"
3 +I'm using "mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (x86_64) using readline 5.0"
6 6  
7 7  Also, I've been running successfully with UTF8 WITHOUT "LANG=en_US.UTF-8" env-var setting. Is this really necessary? It seems quite broken for an environment variable in the server's shell to affect the language settings of webapps running on that server.... (not that that's a good reason for a "feature" like this to occur).
8 -
XWiki.XWikiComments[7]
Comment
... ... @@ -1,3 +1,1 @@
1 -Same as AleksSokolov:
2 -How to force PDF Export work properly with UTF-8 encoding? FC9 1.5 and 1.6 xwiki on tomcat, postgresql.
3 -Getting "#" instead of Russian letters when doing PDF export.
1 +Same as AleksSokolov: How to force PDF Export work properly with UTF-8 encoding? FC9 1.5 and 1.6 xwiki on tomcat, postgresql. Getting "#" instead of Russian letters when doing PDF export.
XWiki.XWikiComments[8]
Comment
... ... @@ -1,6 +1,3 @@
1 -So, russian guys, did you found the solution for encoding problem?
2 -BTW, the main problem for me is this:
3 -when i trying to attach file with russian symbols in the name and click - "Add"
4 -This file attaching with the name without russian symbols... for example <russian word>.txt -> .txt OR <rus word>123<rus word>.txt -> 123.txt
1 +So, russian guys, did you found the solution for encoding problem? BTW, the main problem for me is this: when i trying to attach file with russian symbols in the name and click - "Add" This file attaching with the name without russian symbols... for example {{html clean="false" wiki="true"}}<russian word>.txt -> .txt OR <rus word>123<rus word>.txt -> 123.txt
5 5  How i can fix this?
6 -Please, somebody help.
3 +Please, somebody help.{{/html}}
XWiki.XWikiComments[9]
Comment
... ... @@ -1,3 +1,3 @@
1 -LOL... "<" and ">" ate my words...
1 +LOL... "{{html clean="false" wiki="true"}}<" and ">" ate my words...
2 2  I mean in previous post:
3 -for example "russian_word.txt" -> ".txt" OR "Russian_word123.txt" -> "123.txt" How i can fix this?
3 +for example "russian_word.txt" -> ".txt" OR "Russian_word123.txt" -> "123.txt" How i can fix this?{{/html}}
Date
... ... @@ -1,1 +1,1 @@
1 -2010-01-20 07:52:49.964
1 +2010-01-20 07:52:49.0

Get Connected