Wiki source code of Encoding

Last modified by Vincent Massol on 2020/06/25

Hide last authors
Guillaume Fenollar 13.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
slauriere 1.1 4
Thomas Mortagne 25.1 5 Below you have the configuration for UTF-8.
slauriere 1.1 6
Silvia Macovei 12.2 7 = Servlet Container =
slauriere 1.1 8
Vincent Massol 26.2 9 == Tomcat ==
10
Vincent Massol 26.4 11 Since Tomcat 8.0.x, the [[##URIEncoding## property is ##UTF8## by default>>http://tomcat.apache.org/tomcat-8.0-doc/config/http.html#Common_Attributes]]:
Vincent Massol 26.2 12
Vincent Massol 26.3 13 > This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, UTF-8 will be used unless the org.apache.catalina.STRICT_SERVLET_COMPLIANCE system property is set to true in which case ISO-8859-1 will be used.
Vincent Massol 26.2 14
Silvia Macovei 12.2 15 == Jetty ==
Silvia Macovei 12.1 16
Marius Dumitru Florea 16.1 17 {{code}}
18 echo off
slauriere 1.1 19 rem set LANG=fr_FR.ISO8859-1
20 set LANG=en_US.UTF-8
21 set JETTY_PORT=8080
22 set JETTY_HOME=.
Manuel Smeria 15.2 23 java %JAVA_OPTS% -Djetty.port=%JETTY_PORT% -Djetty.home=%JETTY_HOME% -Dfile.encoding=UTF-8 -jar %JETTY_HOME%/start.jar
24 {{/code}}
machac 1.4 25
Manuel Smeria 15.2 26 Instead of the config system variable LANG you can use JVM properties.
27
Silvia Macovei 12.1 28 {{code}}
machac 1.4 29 -Duser.language=en
30 -Duser.country=US
Silvia Macovei 12.1 31 {{/code}}
machac 1.4 32
33 in server startup script.
34
Manuel Smeria 15.2 35 == [[Glassfish>>http://glassfish.java.net/]] ==
cypromis 9.1 36
Vincent Massol 19.5 37 To run XWiki with UTF-8 in Glassfish you will need to recreate the XWiki WAR file and do a change to the glassfish config. First, in the Administration GUI under Domain => General => Locale enter **en_US.UTF-8**.
cypromis 9.1 38
Manuel Smeria 15.2 39 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.
Silvia Macovei 12.1 40
Manuel Smeria 15.2 41 Create a new directory that we will use as a temporary place to edit our war file:
Silvia Macovei 12.1 42
43 {{code}}
44 mkdir xwikitmp
45 {{/code}}
46
Vincent Massol 19.6 47 Unpack the warfile (replace ##<suffix>## with the proper name for the version of XWiki you're using):
Silvia Macovei 12.1 48
49 {{code}}
Vincent Massol 19.6 50 cd xwikitemp;jar xvf ../xwiki-<suffix>.war
Silvia Macovei 12.1 51 {{/code}}
52
cypromis 9.1 53 Edit the files as mentioned in the beginning of this article:
Silvia Macovei 12.1 54
cypromis 9.1 55 * wiki.cfg
56 * web.xml
57 * hibernate.cfg.xml
Silvia Macovei 12.1 58
Manuel Smeria 15.2 59 Now let's create a new warfile which contains all the changes:
cypromis 9.1 60
Silvia Macovei 12.1 61 {{code}}
Vincent Massol 19.7 62 jar cvf ../xwiki-<suffix>.war .
Silvia Macovei 12.1 63 {{/code}}
64
cypromis 9.1 65 Now you can deploy your new .war file to Glassfish and it will have all the changes in it and wll be correctly deployed.
66
slauriere 20.1 67 = Web server =
68
69 == Apache ==
70
71 Make sure that the Apache configuration file ##httpd.conf## contains the following line:
72
73 {{code}}
74 AddDefaultCharset UTF-8
75 {{/code}}
76
Silvia Macovei 12.2 77 = System config =
cypromis 9.1 78
Manuel Smeria 15.2 79 Add the following variables to your system:
slauriere 1.1 80
Silvia Macovei 12.1 81 {{code}}
WilliamLesguillier 2.1 82 LANG = en_US.UTF-8
Silvia Macovei 12.1 83 {{/code}}
slauriere 1.1 84
Manuel Smeria 15.2 85 [[Credits>>http://markmail.org/message/qitvntzz7cwpyo2w]]
petskratt 15.1 86
87 = OpenOffice import =
88
Manuel Smeria 15.2 89 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:
petskratt 15.1 90
91 {{code}}
92 <item
93 oor:path="/org.openoffice.Office.Common/Filter/HTML/Export"><prop
94 oor:name="Encoding" oor:op="fuse"><value>76</value></prop></item>
95 {{/code}}
96
Manuel Smeria 15.2 97 [[Credits>>http://lists.xwiki.org/pipermail/users/2011-November/021004.html]]
slauriere 20.1 98
99 = Tools =
100
101 * The [[Admin Tools extension>>extensions:Extension.Admin Tools Application]] can be helpful to identify the values of the XWiki encoding configuration parameters on a running server.

Get Connected