Wiki source code of Character Encoding

Last modified by Eleni Cojocariu on 2026/11/25 14:38

Hide last authors
Eleni Cojocariu 2.1 1 XWiki reads, stores and serves text as ##UTF-8##, and the distribution ships that way: the character encoding filter in ##xwiki/WEB-INF/web.xml## and the ##xwiki.encoding## parameter in ##xwiki/WEB-INF/xwiki.cfg## are both set to ##UTF-8##, and there is nothing to change in the wiki administration. What can still corrupt characters is the stack around it.
2
3 |=Layer|=What it has to do|=What you have to do
4 |XWiki|Read and write every request, page and attachment as ##UTF-8##|Nothing.
Eleni Cojocariu 6.4 5 |Servlet container|Decode request URIs as ##UTF-8##|Nothing on a [[supported container>>doc:documentation.xs.admin.installation.servlet-container.WebHome]]. Tomcat decodes them as ##UTF-8## by default.
Eleni Cojocariu 2.1 6 |Reverse proxy|Pass on the character set XWiki declares|Nothing by default. Apache's ##AddDefaultCharset## directive can add one of its own, see [[Apache Server Key Configurations>>doc:documentation.xs.admin.installation.http-reverse-proxy.apache-key-configurations.WebHome]].
Eleni Cojocariu 6.3 7 |Database|Store text in a ##UTF-8## character set|Set the character set when you create the database, as described for each [[supported database>>doc:documentation.xs.admin.installation.database.WebHome]].
Eleni Cojocariu 2.1 8 |Operating system|Give the XWiki process a ##UTF-8## locale|Set it when the server runs in the ##C## or ##POSIX## locale, see below.
9
10 == Operating System Locale ==
11
Eleni Cojocariu 5.1 12 The Java virtual machine decodes file //contents// as ##UTF-8##, but the character set it uses for file //names//, ##sun.jnu.encoding##, follows the operating system locale. A server left in the ##C## or ##POSIX## locale therefore reads and writes file names as ASCII, and a path holding any other character stops resolving: XWiki cannot open its permanent directory or its configuration files when one of the directories leading to them has a non-ASCII name. Give the account that runs XWiki a ##UTF-8## locale:
Eleni Cojocariu 2.1 13
14 {{code language="none"}}
15 LANG=C.UTF-8
16 {{/code}}
17
18 == Values of a Running Instance ==
19
20 The [[Admin Tools Application>>doc:extensions:Extension.Admin Tools Application.WebHome]] reports the encoding configuration parameters an instance is actually using.

Get Connected