Encoding of CLOB (XWD_CONTENT) after Oracle DB Upgrade causes ? instead of special chars

We upgraded our Oracle DB 11g to 12c (with pluggable Database). No encoding or languagesettings were changed in XWiki or the Database.
XWiki is no longer able to display special Characters /German Umlaute (ä,ö,ü) and prints an “?” instead. The special characters are displayed correctly in the database. The problem appears only with the content of a page (databasetable XWIKI.XWIKIDOC, column XWD_CONTENT), which is of datatype “CLOB”.
At the rest of the HTML-page and the page titles (column XWD_CONTENT, type “VARCHAR2”) the special characters are displayed correctly.

image

Versions:

Oracle DB 12.2.0.1
Apache Tomcat 9.0.43
Xwiki 12.10.9 (same error with 5.0.3)
Linux Red Hat 7

These parameters are the same in both environments:

NLS_CHARACTERSET=WE8ISO8859P15
nls_length_semantics=CHAR
LANG=de_DE.UTF-8
NLS_LANGUAGE=AMERICAN
NLS_TERRITORY=AMERICA

These are our current settings:

1) html

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

2) hibernate.cfg.xml

 <property name="hibernate.connection.url">jdbc:oracle:thin:@host:port/servicename-pluggable-db</property>
    <property name="hibernate.connection.username">xwiki</property>
    <property name="hibernate.connection.password">xxxxxxxx</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="hibernate.connection.SetBigStringTryClob">true</property>
    <property name="hibernate.jdbc.batch_size">0</property>
    <property name="hibernate.jdbc.use_streams_for_binary">false</property>
    <property name="hibernate.dbcp.poolPreparedStatements">true</property>
    <property name="hibernate.dbcp.maxOpenPreparedStatements">20</property>

    <property name="hibernate.connection.charSet">UTF-8</property>
    <property name="hibernate.connection.useUnicode">true</property>
    <property name="hibernate.connection.characterEncoding">utf8</property>

    <mapping resource="xwiki.oracle.hbm.xml"/>
    <mapping resource="feeds.oracle.hbm.xml"/>
    <mapping resource="instance.hbm.xml"/>
    <mapping resource="notification-filter-preferences.hbm.xml"/>
    <mapping resource="mailsender.oracle.hbm.xml"/>

3) xwiki.cfg

xwiki.encoding=UTF-8

4) web.xml

 <param-name>encoding</param-name>
 <param-value>UTF-8</param-value>

5) javaoptions:

CATALINA_OPTS="-Xmx1024m -Dfile.encoding=UTF-8 -Dappserver.home=$CATALINA_HOME -Dappserver.base=$CATALINA_HOME  $XWIKI_OPTS"

6) XWiki AdminTools > XWiki Configuration Check > Encoding Configuration

System environment
•LANG :de_DE.UTF-8
•PWD :/usr/TOMCAT/apache-tomcat-9.0.43/bin

Java command line
•file.encoding: UTF-8
•mail.mime.charset: null

Tomcat configuration
•Procotol HTTP/1.1 has encoding UTF-8

XWiki Configuration
•XWiki encoding used on server: UTF-8
•XWiki encoding from config file: UTF-8

Our question is:

Why are CLOBs interpreted differently when Oracle DB12 is used? Is something missing in hibernate.cfg.xml?

I’m really not an Oracle expert, but on Hibernate side I see that a Oracle12cDialect exist, so that might help. That being said setting the dialect is generally not needed in the configuration as Hibernate is supposed to find the right one automatically.

Thanks, I tried using “Oracle12cDialect” and also uncommenting the whole dialect line. But in both cases no effect after restart and flushing cache.

It really wasn’t a XWiki Problem, but a Oracle DB 12.2 Database Bug (# 26380097).
This is fixed by appying the Patch with the same number.
JDBC has a problem with reading the CLOB entries.