5 Replies Latest reply on Dec 31, 2007 9:17 AM by Billy~Verreynne

    how to use sqlplus with utf8 on windows command line

    joehtg
      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 €