Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

how to use sqlplus with utf8 on windows command line

2920439Dec 19 2007 — edited Dec 31 2007
I expected sqlplus to work interactively with the following settings:
- Lucida Console font for command window
- chcp 65001 (UTF8-Windows-Codepage)
- set NLS_LANG=.AL32UTF8

But it turned out that
1) sqlplus apparently does not use WIN32-API function ReadConsoleW and WriteConsoleW (these wide char functions must be used instead of ReadFile and WriteFile for Console I/O)
2) cmd silently ignores all .cmd and .bat files with codepage set to 65001.

I fear that such a problem regarding a minority of command line freaks has low priority for Oracle and for Microsoft, so I wrote two small filters in C.

rconsu8 passes keyboard input to stdout, using ReadConsoleW
wconsu8 passes stdin to console, using WriteConsoleW
both set the UTF8-codepage 65001 and restore the previous codepage at exit.

Anybody interested?
(Yes, I know that I could use sqldeveloper.)

Sample session:
C:\>set NLS_LANG=.AL32UTF8
C:\>rconsu8 | sqlplus scott/tiger@DBUTF8 | wconsu8

SQL> select '€' from dual;

'€'
---


SQL> select * from test_cyrillic;

NAME
---------------------------------------------------------------------------
Йозеф

Euro €

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 28 2008
Added on Dec 19 2007
5 comments
35,558 views