Forum Stats

  • 3,839,636 Users
  • 2,262,517 Discussions
  • 7,901,025 Comments

Discussions

After migration: French special characters from bundle not showing correctly

Filip Huysmans
Filip Huysmans Member Posts: 290 Bronze Badge
edited Mar 31, 2022 8:31AM in JDeveloper and ADF

Hello everyone,

we did a migration from JDev/ADF 11.1.1.7.0 to 12.2.1.4.0 (Build JDEVADF_PT.12.2.1.4.0_GENERIC_190911.2248.S).

The application seems to be working fine, except for the special characters coming from our resource bundles.

We have French as a second language in our application. The labels for buttons and links and fields are stored in resource bundles. These files are UTF-8 encoded. Opening the files in JDev shows the correct characters.

Running the application results in words like :

Being Récupérations and Sécurité.

We believe that somehow the JRE is not running in UTF-8 mode.

The information coming from the database is correct. Data from the db is showing the special characters correctly. Only the ones that are coming from the resource bundles are giving these strange characters.

This problem did not exist in the 11g version.

The problem present itself in the embedded WLS and a standalone WLS instance.

Anyone any idea to solve this?


Thx

Tagged:

Best Answer

«1

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,596 Red Diamond

    Try creating a new app directly in 12.2.1.4 using data from a bundle with special french characters. If they show in the new app we know that the problem is related to the migration. If you still see the wrong characters, we go on from there.


    Timo

  • Filip Huysmans
    Filip Huysmans Member Posts: 290 Bronze Badge

    Hi Timo,


    thx a lot. In a clean app this works correctly.

  • Filip Huysmans
    Filip Huysmans Member Posts: 290 Bronze Badge
    edited Apr 1, 2022 2:31PM

    After close investigation in the new app, we see that the resource bundle is correctly in utf-8 encoding, but the value of my translation string is in ascii code: My Text\\nR\u00E9soudre S\u00E9cr\u00E9\u00E7\u00E7\u00E0\u00E0\u00E0\u00E9\u00E9

    This shows correctly in the application, but this could not be the way of working?

    Is this normal?

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,596 Red Diamond

    Actually, it is the right way to work. You have to be careful when you edit resources using an editor where you don't know how the editor handles the character sets. If you are running under windows it's very hard to understand. Almost all editors use the windows character set instead of UTF-8.

    The solution is to use the /unnnn notation where /u denotes a Unicode character and nnnn is the number.

    This is fail-safe but harder to read.

    Timo

  • Filip Huysmans
    Filip Huysmans Member Posts: 290 Bronze Badge

    Hi Timo,


    to be clear: we are opening the resource bundle within JDeveloper and then we see these characters.

    For the French language, this is almost impossible to manage.

    We believe that everything is in UTF-8, except for our JSF engine.

    Is there a setting somewhere we can manipulate to tell JSF that the files are UTF-8 encoded?


    Thx

  • Filip Huysmans
    Filip Huysmans Member Posts: 290 Bronze Badge
    edited Apr 1, 2022 4:30PM

    While we can use JDeveloper wizard "Select Text Resource" to manage our default resource bundle, we can not use it to manage our second language (in our case French).

    To manage the French text, we need to open the resource bundles manually through JDeveloper or through Notepad++, in either case we see the unicode characters and not the special French characters.

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,596 Red Diamond

    As I said, JDev uses the /unnnn notation as it works everywhere. In s resource bundle you should use the /unnnn notation if possible as it guarantees that you see the right character in the UI.

    What we do for multi-language bundles is to first translate them in any editor you like, then use a small java utility class to convert the national characters into /unnnn notation. Then use the converted string in the bundle.


    Timo

  • Filip Huysmans
    Filip Huysmans Member Posts: 290 Bronze Badge
    edited Apr 2, 2022 8:35AM

    Hi Timo,


    thx for the insight.

    I presume you are talking about the native2ascii.exe tool. I tried that, but it messes with the keys also. I'm not sure why, since there are no special characters in the keys, resulting in the fact that the keys are not found anymore by the application. Am I missing something here?

    I performed the following operation: native2ascii.exe original_resource_bundle.properties new_resource_bundle.properties

    Any ideas are more than welcome.


    Thx

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,596 Red Diamond
    Answer ✓

    No, I'm not talking about native2ascii as you don't want ascii. You can simply write a small java class to to the work or look at this tool https://r12a.github.io/app-conversion/


    Timo

  • Filip Huysmans
    Filip Huysmans Member Posts: 290 Bronze Badge

    Hi Timo,


    thx for the reference. I changed the characters in the property files, which resulted in a positive effect.

    While this solves the issue in runtime, in design time this brings another problem: this is not manageable.

    Thx for your help and insight.

    Filip