Search code examples
htmlplsqloracle-sqldeveloperoracle-apex

Rich text editor and Umlaute in Oracle Apex


I have a table History that records changes to the application so that users know what's new and what's changed. Currently the changes are recorded manually through a rich editor and saved through an automatic insert process from Oracle Apex 18.2.

I tested the following input through a normal insert in the Sqldeveloper:

insert into history_table
(datum, beschreibung)
values
(sysdate, 'Test Umlaute : Ää - Aa; Üü - Uu; Öö - Oo');

The data shown on the Apex page is the following. It's the same when I selected it on the developer, as I expected:

Test Umlaute : Ää - Aa; Üü - Uu; Öö - Oo

When I try the same thing through the rich text editor and the automatic insert I receive the correct inserted data on the page, but this on the developer:

<p>Test Umlaute : &Auml;&auml; - Aa; &Uuml;&uuml; - Uu; &Ouml;&ouml; - Oo</p>

Through using this code I can manage to replace it all, but only really in the query not if someone tries to download automatically through the website:

select regexp_replace(replace(replace(replace(replace(replace(replace(beschreibung, 'Auml', 'Ä'), 'auml', 'ä'), 'Uuml', 'Ü'), 'uuml', 'ü'), 'Ouml', 'Ö'), 'ouml', 'ö'), '&|;|nbsp', '') beschreibung
from history_table;

Is there a way to parse and replace the HTML identifiers somewhere in between the insert commands to the actual letters while the Rich Text Editor is still used?


Solution

  • this is default CKEditor behaviour. All non-ascii characters are translated to the corresponding html entity. You have the option of changing the settings of the CKEditor for an item as explained in this blog: https://apex.oracle.com/pls/apex/germancommunities/apexcommunity/tipp/6401/index-en.html I did a quick test with the javascript function below and it seems to work fine. Put it in the Javascript Initialization Code section of the rich text editor item.

    function ( configObject ) {
        configObject.entities = false;
        return configObject;
    }
    

    The available settings for CKEditor are available here: https://docs-old.ckeditor.com/ckeditor_api/symbols/CKEDITOR.config.html#.entities