Skip to content

CLI shows question marks instead of Russian symbols #169

@alesana-san

Description

@alesana-san

Hi!

What started in a Slack chat grew into this issue :)

I have a test with Russian words in its name. So I expect it to be "Russian" when I call it via cli.

Here's my preset:

  • NLS_DATABASE_PARAMETERS:
    • NLS_TERRITORY = AMERICA
    • NLS_LANGUAGE = AMERICAN
    • NLS_CHARACTERSET = CL8ISO8859P5
  • NLS_SESSION_PARAMETERS (via DataGrip):
    • NLS_LANGUAGE = RUSSIAN
    • NLS_TERRITORY = RUSSIA
  • Database Version = 12.2.0.1.0

Calling ut.run in DataGrip results in a good output with all my Russian symbols.

Okay, let's proceed with cli:

C:\Users\Shiryaev1-RY>chcp
Текущая кодовая страница: 866

C:\Users\Shiryaev1-RY>utplsql.bat info "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb
utPLSQL-cli 3.1.8-SNAPSHOT.local
utPLSQL-java-api 3.1.8.546
utPLSQL 3.1.6.2735

Calling as it is:

C:\Users\Shiryaev1-RY>utplsql.bat run "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb -p=SP.ut_sp_hand_get_reqs.basic_usage -d
2019-11-26 17:54:08 [main] INFO  org.utplsql.cli.RunAction - ############# utPLSQL cli ##############
#                                      #
#   utPLSQL-cli 3.1.8-SNAPSHOT.local   #
#   utPLSQL-java-api 3.1.8.546         #
#   Java-Version: 1.8.0_221            #
#   ORACLE_HOME: null                  #
#   NLS_LANG: null                     #
#                                      #
#   Thanks for testing!                #
#                                      #
########################################
2019-11-26 17:54:08 [main] INFO  org.utplsql.cli.RunAction -
2019-11-26 17:54:09 [main] INFO  o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:****/****@local_pdb
2019-11-26 17:54:09 [main] INFO  org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.6.2735
2019-11-26 17:54:09 [main] INFO  org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2019-11-26 17:54:10 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_DOCUMENTATION_REPORTER, ID: 98420D7BA25A031BE053020012ACA88D
2019-11-26 17:54:10 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - Running tests now.
2019-11-26 17:54:10 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2019-11-26 17:54:10 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - TestRunner initialized
2019-11-26 17:54:10 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running on utPLSQL v3.1.6.2735
2019-11-26 17:54:10 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Initializing reporters
2019-11-26 17:54:11 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests
simple_payment
  sp_req_handler_pkg
2019-11-26 17:54:11 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests finished.
    get_reqs_to_process
      ????? ????????? sp_req_handler_pkg.get_reqs_to_process
        ???? ???????? ????????????? [,004 sec]

Finished in ,028223 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

2019-11-26 17:54:11 [main] INFO  org.utplsql.cli.RunAction - --------------------------------------
2019-11-26 17:54:11 [main] INFO  org.utplsql.cli.RunAction - All tests done.

Nope, didn't work.

Let's try with LC_ALL:

C:\Users\Shiryaev1-RY>set LC_ALL=ru_RU.utf-8

C:\Users\Shiryaev1-RY>utplsql.bat run "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb -p=SP.ut_sp_hand_get_reqs.basic_usage -d
2019-11-26 17:55:30 [main] INFO  org.utplsql.cli.RunAction - ############# utPLSQL cli ##############
#                                      #
#   utPLSQL-cli 3.1.8-SNAPSHOT.local   #
#   utPLSQL-java-api 3.1.8.546         #
#   Java-Version: 1.8.0_221            #
#   ORACLE_HOME: null                  #
#   NLS_LANG: null                     #
#                                      #
#   Thanks for testing!                #
#                                      #
########################################
2019-11-26 17:55:30 [main] INFO  org.utplsql.cli.RunAction -
2019-11-26 17:55:30 [main] INFO  o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:****/****@local_pdb
2019-11-26 17:55:30 [main] INFO  org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.6.2735
2019-11-26 17:55:30 [main] INFO  org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2019-11-26 17:55:31 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_DOCUMENTATION_REPORTER, ID: 9842124F42B6034AE053020012ACF6A3
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - Running tests now.
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - TestRunner initialized
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running on utPLSQL v3.1.6.2735
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Initializing reporters
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests
2019-11-26 17:55:31 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests finished.
simple_payment
  sp_req_handler_pkg
    get_reqs_to_process
      ????? ????????? sp_req_handler_pkg.get_reqs_to_process
        ???? ???????? ????????????? [,004 sec]

Finished in ,009586 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

2019-11-26 17:55:31 [main] INFO  org.utplsql.cli.RunAction - --------------------------------------
2019-11-26 17:55:31 [main] INFO  org.utplsql.cli.RunAction - All tests done.

Noooooooope. Okay, let's try with NLS_LANG:

C:\Users\Shiryaev1-RY>set LC_ALL=

C:\Users\Shiryaev1-RY>set NLS_LANG=russian_russia.CL8ISO8859P5

C:\Users\Shiryaev1-RY>utplsql.bat run "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb -p=SP.ut_sp_hand_get_reqs.basic_usage -d
2019-11-26 17:57:39 [main] INFO  org.utplsql.cli.RunAction - ################ utPLSQL cli ################
#                                           #
#   utPLSQL-cli 3.1.8-SNAPSHOT.local        #
#   utPLSQL-java-api 3.1.8.546              #
#   Java-Version: 1.8.0_221                 #
#   ORACLE_HOME: null                       #
#   NLS_LANG: russian_russia.CL8ISO8859P5   #
#                                           #
#   Thanks for testing!                     #
#                                           #
#############################################
2019-11-26 17:57:39 [main] INFO  org.utplsql.cli.RunAction -
2019-11-26 17:57:39 [main] DEBUG o.u.c.d.TestedDataSourceProvider - NLS settings: BEGIN
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_LANGUAGE='russian']';
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_TERRITORY='russia']';
END;
2019-11-26 17:57:40 [main] INFO  o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:****/****@local_pdb
2019-11-26 17:57:40 [main] INFO  org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.6.2735
2019-11-26 17:57:40 [main] INFO  org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2019-11-26 17:57:40 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_DOCUMENTATION_REPORTER, ID: 98421A084170039EE053020012AC52B2
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - Running tests now.
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - TestRunner initialized
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running on utPLSQL v3.1.6.2735
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Initializing reporters
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests
2019-11-26 17:57:40 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests finished.
simple_payment
  sp_req_handler_pkg
    get_reqs_to_process
      ????? ????????? sp_req_handler_pkg.get_reqs_to_process
        ???? ???????? ????????????? [,013 sec]

Finished in ,015801 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

2019-11-26 17:57:40 [main] INFO  org.utplsql.cli.RunAction - --------------------------------------
2019-11-26 17:57:40 [main] INFO  org.utplsql.cli.RunAction - All tests done.

God, plz! After looking at Oracle NLS stories I decided to do the following:

C:\Users\Shiryaev1-RY>set NLS_LANG=russian_russia.RU8PC866

C:\Users\Shiryaev1-RY>utplsql.bat run "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb -p=SP.ut_sp_hand_get_reqs.basic_usage -d
2019-11-26 17:59:53 [main] INFO  org.utplsql.cli.RunAction - ############## utPLSQL cli ##############
#                                       #
#   utPLSQL-cli 3.1.8-SNAPSHOT.local    #
#   utPLSQL-java-api 3.1.8.546          #
#   Java-Version: 1.8.0_221             #
#   ORACLE_HOME: null                   #
#   NLS_LANG: russian_russia.RU8PC866   #
#                                       #
#   Thanks for testing!                 #
#                                       #
#########################################
2019-11-26 17:59:53 [main] INFO  org.utplsql.cli.RunAction -
2019-11-26 17:59:53 [main] DEBUG o.u.c.d.TestedDataSourceProvider - NLS settings: BEGIN
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_LANGUAGE='russian']';
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_TERRITORY='russia']';
END;
2019-11-26 17:59:54 [main] INFO  o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:****/****@local_pdb
2019-11-26 17:59:54 [main] INFO  org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.6.2735
2019-11-26 17:59:54 [main] INFO  org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2019-11-26 17:59:54 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_DOCUMENTATION_REPORTER, ID: 98422208E89A03F6E053020012AC69AF
2019-11-26 17:59:54 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - Running tests now.
2019-11-26 17:59:54 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2019-11-26 17:59:54 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - TestRunner initialized
2019-11-26 17:59:54 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running on utPLSQL v3.1.6.2735
2019-11-26 17:59:54 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Initializing reporters
2019-11-26 17:59:55 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests
2019-11-26 17:59:55 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests finished.
simple_payment
  sp_req_handler_pkg
    get_reqs_to_process
      ????? ????????? sp_req_handler_pkg.get_reqs_to_process
        ???? ???????? ????????????? [,004 sec]

Finished in ,007218 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

2019-11-26 17:59:55 [main] INFO  org.utplsql.cli.RunAction - --------------------------------------
2019-11-26 17:59:55 [main] INFO  org.utplsql.cli.RunAction - All tests done.

Well, let's take another shot:

C:\Users\Shiryaev1-RY>set NLS_LANG=russian_cis.CL8MSWIN1251

C:\Users\Shiryaev1-RY>utplsql.bat run "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb -p=SP.ut_sp_hand_get_reqs.basic_usage -d
2019-11-26 18:03:19 [main] INFO  org.utplsql.cli.RunAction - ############## utPLSQL cli ###############
#                                        #
#   utPLSQL-cli 3.1.8-SNAPSHOT.local     #
#   utPLSQL-java-api 3.1.8.546           #
#   Java-Version: 1.8.0_221              #
#   ORACLE_HOME: null                    #
#   NLS_LANG: russian_cis.CL8MSWIN1251   #
#                                        #
#   Thanks for testing!                  #
#                                        #
##########################################
2019-11-26 18:03:19 [main] INFO  org.utplsql.cli.RunAction -
2019-11-26 18:03:19 [main] DEBUG o.u.c.d.TestedDataSourceProvider - NLS settings: BEGIN
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_LANGUAGE='russian']';
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_TERRITORY='cis']';
END;
2019-11-26 18:03:19 [main] INFO  o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:****/****@local_pdb
2019-11-26 18:03:20 [main] INFO  org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.6.2735
2019-11-26 18:03:20 [main] INFO  org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2019-11-26 18:03:20 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_DOCUMENTATION_REPORTER, ID: 98422E48D8890483E053020012ACCC0D
2019-11-26 18:03:20 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - Running tests now.
2019-11-26 18:03:20 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2019-11-26 18:03:20 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - TestRunner initialized
2019-11-26 18:03:20 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running on utPLSQL v3.1.6.2735
2019-11-26 18:03:20 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Initializing reporters
2019-11-26 18:03:20 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests
2019-11-26 18:03:21 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests finished.
simple_payment
  sp_req_handler_pkg
    get_reqs_to_process
      ????? ????????? sp_req_handler_pkg.get_reqs_to_process
        ???? ???????? ????????????? [,013 sec]

Finished in ,038208 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

2019-11-26 18:03:21 [main] INFO  org.utplsql.cli.RunAction - --------------------------------------
2019-11-26 18:03:21 [main] INFO  org.utplsql.cli.RunAction - All tests done.

Oh, I forgot to switch chcp to 1251. And again...

C:\Users\Shiryaev1-RY>chcp 1251
Текущая кодовая страница: 1251

C:\Users\Shiryaev1-RY>utplsql.bat run "some_user"/"q1w2e3r4t5y6u7i8o9p0"@local_pdb -p=SP.ut_sp_hand_get_reqs.basic_usage -d
2019-11-26 18:03:37 [main] INFO  org.utplsql.cli.RunAction - ############## utPLSQL cli ###############
#                                        #
#   utPLSQL-cli 3.1.8-SNAPSHOT.local     #
#   utPLSQL-java-api 3.1.8.546           #
#   Java-Version: 1.8.0_221              #
#   ORACLE_HOME: null                    #
#   NLS_LANG: russian_cis.CL8MSWIN1251   #
#                                        #
#   Thanks for testing!                  #
#                                        #
##########################################
2019-11-26 18:03:37 [main] INFO  org.utplsql.cli.RunAction -
2019-11-26 18:03:37 [main] DEBUG o.u.c.d.TestedDataSourceProvider - NLS settings: BEGIN
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_LANGUAGE='russian']';
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_TERRITORY='cis']';
END;
2019-11-26 18:03:37 [main] INFO  o.u.c.d.TestedDataSourceProvider - Use connection string jdbc:oracle:thin:****/****@local_pdb
2019-11-26 18:03:37 [main] INFO  org.utplsql.cli.RunAction - Successfully connected to database. UtPLSQL core: v3.1.6.2735
2019-11-26 18:03:37 [main] INFO  org.utplsql.cli.RunAction - Oracle-Version: 12.2.0.1.0
2019-11-26 18:03:38 [main] DEBUG org.utplsql.api.reporter.Reporter - Database-reporter initialized, Type: UT_DOCUMENTATION_REPORTER, ID: 98422F56D51D0497E053020012AC7817
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - Running tests now.
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.cli.RunTestRunnerTask - --------------------------------------
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - TestRunner initialized
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running on utPLSQL v3.1.6.2735
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Initializing reporters
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests
2019-11-26 18:03:38 [pool-1-thread-1] INFO  org.utplsql.api.TestRunner - Running tests finished.
simple_payment
  sp_req_handler_pkg
    get_reqs_to_process
      ????? ????????? sp_req_handler_pkg.get_reqs_to_process
        ???? ???????? ????????????? [,004 sec]

Finished in ,008281 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

2019-11-26 18:03:38 [main] INFO  org.utplsql.cli.RunAction - --------------------------------------
2019-11-26 18:03:38 [main] INFO  org.utplsql.cli.RunAction - All tests done.

And what about sqlplus?

C:\Users\Shiryaev1-RY>sqlplus some_user/q1w2e3r4t5y6u7i8o9p0@local_pdb

SQL*Plus: Release 11.2.0.4.0 Production on Вт Ноя 26 18:11:20 2019

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


Присоединен к:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> HOST ECHO %NLS_LANG%
russian_russia.RU8PC866

SQL> @.[%NLS_LANG%].
SP2-0310: не в состоянии открыть файл ".[russian_russia.RU8PC866]..sql"
SQL> set serveroutput on
SQL> exec ut.run('SP.ut_sp_hand_get_reqs.basic_usage');
simple_payment
sp_req_handler_pkg
get_reqs_to_process
Тесты процедуры sp_req_handler_pkg.get_reqs_to_process
Тест базового использования [.004 sec]
Finished in .027698 seconds
1 tests, 0 failed, 0 errored, 0 disabled, 0 warning(s)

Процедура PL/SQL успешно завершена.

It works just fine! I call ut.run and output is okay! It's in Russian.

Hands down, I don't get how charset stuff works. Any help would be appreciated!

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions