Forum Stats

  • 3,767,979 Users
  • 2,252,735 Discussions
  • 7,874,399 Comments

Discussions

Russian charecters are not displayed correctly in sqlci with UTF8 encoding?

bglazyr
bglazyr Member Posts: 48 Bronze Badge

Hello! I am trying to use sqlcl, but get problems with Russian symbols.

Our database use UTF8 charset and we store not only English and Russian chars, but some European languages too. So on windows 10 computer I set UTF8 codepage in command window.

So, our first problem - sqlcl doesn't show Russian chars in select results.

Here is simplified testcase:

---

D:\...\tests>chcp 65001

Active code page: 65001

D:\...\tests>echo 'Hello World! Привет мир!'

'Hello World! Привет мир!'

---

So, as you can see, command window correctly display russian chars.

---

D:\...\tests>sql t1/***@****:1521:***

SQLcl: Release 21.3 Production on  22 16:05:52 2021

Copyright (c) 1982, 2021, Oracle. All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select 'Hello world! Привет мир!' from dual;

   'HELLOWORLD!!'

___________________________

Hello world! !

----

As you can see, All Russian chars are lost.

I tried to change encoding in sqlcl, but same result:

---

SQL> show encoding

encoding "windows-1251"

SQL> set encoding UTF8

SQL> show encoding

encoding "UTF8"

SQL> select 'Hello world! Привет мир!' from dual;

   'HELLOWORLD!!'

___________________________

Hello world! !

====

If I execute sql script (with UTF8 encoding) with inserts, that have Russian chars - then they are correctly inserted in DB. I rechecked it from SQLDeveloper.

If I change chcp to 1251 and set encoding to windows-1251, then I see Russian chars correctly.

But thats is not an option for me, because we work with European languages too.

Any ideas?

Best regards,

Boris

Answers

  • User_H3J7U
    User_H3J7U Member Posts: 632 Silver Trophy
    • Use an alternate console (MS Store: Windows terminal, Fluent terminal, ...)
    • Appropriate font
    • CMD> chcp 65001
    • CMD> set(x) JAVA_TOOL_OPTIONS=-Dfile.enconding=UTF-8
    • SQL> set encoding utf-8


  • bglazyr
    bglazyr Member Posts: 48 Bronze Badge
    edited Nov 22, 2021 10:19PM

    Hi, thanks for fast reply, but still no success.

    I've tried both consoles without success.

    Here is screenshot on Windows terminal:

    I've tried different fonts. Fonts are definitely changing, but charset is wrong. This screenshot use SimSun-ExtBfont.

    Any ideas what I am missing?

    P.S. Found https://www.thatjeffsmith.com/archive/2016/08/unicode-and-oracle-sqlcl-on-windows/

    Some people recommended ConEmu. Tried it. charecters differs, but Russian chars and umlauts are still not readable.


  • User_H3J7U
    User_H3J7U Member Posts: 632 Silver Trophy

    This screenshot use SimSun-ExtBfont.

    This font contain only standard latin letters, charmap.exe:

    Use the consolas font while testing.

    Any ideas what I am missing?

    The question marks from UMLAUT points to an incompatible charset conversion. To work with a characters for different languages you need AL32UTF8 in the database. The client must have AL32UTF8 for all languages or a national charset to work with only one language.

    UTF8:

    set NLS_LANG=<lang>_<territory>.AL32UTF8
    chcp 65001
    

    Cyrillic windows code page:

    set NLS_LANG=<lang>_<territory>.CL8MSWIN1251
    chcp 1251
    

    This applies to SQL*Plus too.

  • bglazyr
    bglazyr Member Posts: 48 Bronze Badge

    Hi, thanks for reply, but still no success.

    >>To work with a characters for different languages you need AL32UTF8 in the database.

    Yes, our database in AL32UTF8. All selects from SQLDeveloper works fine and correctly shows Russian chars and umlauts.

    If I set NLS_LANG=AMERICAN_AMERICA.AL32UTF8

    Then I get following output:

    Picked up JAVA_TOOL_OPTIONS: -Dfile.enconding=UTF-8

    ��� 23, 2021 2:30:17 AM oracle.dbtools.raptor.scriptrunner.cmdline.SQLCliOptions processNLSLANG

    INFO: NLS_LANG is set, but not valid. Ignoring.

    After that - nothing changes.

    >>Use the consolas font while testing.

    Tried. Nothing changed.

    Any ideas?

    If You have time tomorrow, I can show you my computer in zoom or any other screen sharing tool.