Montag, 10. September 2018

Windows console and UTF-8 and Oracle SQLPLUS

Symptom

 You run scripts in UTF-8 codepage by sqplplus over the bat shell and special characters like umlauts get borked.

Cause

There can be two:
  1. Your bat shell is not running in UTF-8 codepage: Execute chcp to find out. If it returns 65001, you do not have to change anything.
  2. The Oracle ODBC codepage is UTF-8, you do not have to do anything.

Solution

You probably do not need to fiddle with the Windows Registry like described below. You might want to read How to utf-8 with sqlplus too.
  1. Change the codepage of your bat shell to UTF-8 by executing chcp 65001. However, this is a one shot solution only. A permanent solution could be to change registry entry HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\Autorun to @chcp 65001>nul.
    Be aware that for some obscure reason the execution of the dir command in console makes it close invariably!
    Be aware that changing registry entry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP to 65001 is reported to leave your system in an UNBOOTABLE state!
  2. Change the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient12Home\NLS_LANG to AMERICAN_AMERICA.UTF8.

Keine Kommentare:

Kommentar veröffentlichen