Wiki source code of Encoding
Last modified by Vincent Massol on 2020/06/25 10:58
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
| 2 | {{toc/}} | ||
| 3 | {{/box}} | ||
| 4 | |||
| 5 | Below you have the configuration for UTF-8. | ||
| 6 | |||
| 7 | = Servlet Container = | ||
| 8 | |||
| 9 | == Tomcat == | ||
| 10 | |||
| 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]]: | ||
| 12 | |||
| 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. | ||
| 14 | |||
| 15 | == Jetty == | ||
| 16 | |||
| 17 | {{code}} | ||
| 18 | echo off | ||
| 19 | rem set LANG=fr_FR.ISO8859-1 | ||
| 20 | set LANG=en_US.UTF-8 | ||
| 21 | set JETTY_PORT=8080 | ||
| 22 | set JETTY_HOME=. | ||
| 23 | java %JAVA_OPTS% -Djetty.port=%JETTY_PORT% -Djetty.home=%JETTY_HOME% -Dfile.encoding=UTF-8 -jar %JETTY_HOME%/start.jar | ||
| 24 | {{/code}} | ||
| 25 | |||
| 26 | Instead of the config system variable LANG you can use JVM properties. | ||
| 27 | |||
| 28 | {{code}} | ||
| 29 | -Duser.language=en | ||
| 30 | -Duser.country=US | ||
| 31 | {{/code}} | ||
| 32 | |||
| 33 | in server startup script. | ||
| 34 | |||
| 35 | == [[Glassfish>>http://glassfish.java.net/]] == | ||
| 36 | |||
| 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**. | ||
| 38 | |||
| 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. | ||
| 40 | |||
| 41 | Create a new directory that we will use as a temporary place to edit our war file: | ||
| 42 | |||
| 43 | {{code}} | ||
| 44 | mkdir xwikitmp | ||
| 45 | {{/code}} | ||
| 46 | |||
| 47 | Unpack the warfile (replace ##<suffix>## with the proper name for the version of XWiki you're using): | ||
| 48 | |||
| 49 | {{code}} | ||
| 50 | cd xwikitemp;jar xvf ../xwiki-<suffix>.war | ||
| 51 | {{/code}} | ||
| 52 | |||
| 53 | Edit the files as mentioned in the beginning of this article: | ||
| 54 | |||
| 55 | * wiki.cfg | ||
| 56 | * web.xml | ||
| 57 | * hibernate.cfg.xml | ||
| 58 | |||
| 59 | Now let's create a new warfile which contains all the changes: | ||
| 60 | |||
| 61 | {{code}} | ||
| 62 | jar cvf ../xwiki-<suffix>.war . | ||
| 63 | {{/code}} | ||
| 64 | |||
| 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 | |||
| 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 | |||
| 77 | = System config = | ||
| 78 | |||
| 79 | Add the following variables to your system: | ||
| 80 | |||
| 81 | {{code}} | ||
| 82 | LANG = en_US.UTF-8 | ||
| 83 | {{/code}} | ||
| 84 | |||
| 85 | [[Credits>>http://markmail.org/message/qitvntzz7cwpyo2w]] | ||
| 86 | |||
| 87 | = OpenOffice import = | ||
| 88 | |||
| 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: | ||
| 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 | |||
| 97 | [[Credits>>http://lists.xwiki.org/pipermail/users/2011-November/021004.html]] | ||
| 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. |