Encoding

Last modified by Vincent Massol on 2020/06/25

Below you have the configuration for UTF-8.

Servlet Container

Tomcat

Since Tomcat 8.0.x, the URIEncoding property is UTF8 by default:

 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.

Jetty

echo off
rem set LANG=fr_FR.ISO8859-1
set LANG=en_US.UTF-8
set JETTY_PORT=8080
set JETTY_HOME=.
java %JAVA_OPTS% -Djetty.port=%JETTY_PORT% -Djetty.home=%JETTY_HOME% -Dfile.encoding=UTF-8 -jar %JETTY_HOME%/start.jar

Instead of the config system variable LANG you can use JVM properties.

-Duser.language=en
-Duser.country=US

in server startup script.

Glassfish

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.

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.

Create a new directory that we will use as a temporary place to edit our war file:

mkdir xwikitmp

Unpack the warfile (replace <suffix> with the proper name for the version of XWiki you're using):

cd xwikitemp;jar xvf ../xwiki-<suffix>.war

Edit the files as mentioned in the beginning of this article:

  • wiki.cfg
  • web.xml
  • hibernate.cfg.xml

Now let's create a new warfile which contains all the changes:

jar cvf ../xwiki-<suffix>.war .

Now you can deploy your new .war file to Glassfish and it will have all the changes in it and wll be correctly deployed.

Web server

Apache

Make sure that the Apache configuration file httpd.conf contains the following line:

AddDefaultCharset UTF-8

System config

Add the following variables to your system:

LANG = en_US.UTF-8

Credits

OpenOffice import

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:

<item
oor:path="/org.openoffice.Office.Common/Filter/HTML/Export"><prop
oor:name="Encoding" oor:op="fuse"><value>76</value></prop></item>

Credits

Tools

  • The Admin Tools extension can be helpful to identify the values of the XWiki encoding configuration parameters on a running server.

Get Connected