使SQLPlus假冒Unicode字符,输出为?

问题描述:

我正在尝试使Oracle sqlplus(10.2)在Linux计算机上假脱机Unicode数据.除了检查语言环境设置并将NLS_LANG设置为AL32UTF8之外,我已经找到了对该问题的一些讨论,但没有明确的答案.所有语言环境信息都设置为"en_US.UTF-8",我将根据要求发布完整的输出.

I am attempting to get Oracle sqlplus (10.2) to spool out Unicode data on a Linux machine. I have found several discussions of this issue, but no clear answers, other than to check locale settings and set NLS_LANG to AL32UTF8. All locale info is set to "en_US.UTF-8", I'll post the full output upon request.

操作系统(vi等)将识别并接受Unicode字符,而不会出现问题.但是,当使用sqlplus时,所有非ASCII字符都更改为?.人物. Oracle数据库的NLS_CHARACTERSET设置为AL32UTF8,而NLS_NCHAR_CHARACTERSET设置为AL16UTF16.

The OS (vi, etc.), will recognize and accept Unicode characters without issue. However, when using sqlplus, all non-ASCII characters are changed to ? characters. The Oracle DB has NLS_CHARACTERSET set to AL32UTF8, and NLS_NCHAR_CHARACTERSET set to AL16UTF16.

我是否缺少一些需要为sqlplus本身设置的设置或开关?任何想法将不胜感激.

Am I missing some setting or switch that needs to be set for sqlplus itself? Any ideas would be much appreciated.

我找到了答案.显然,在外壳程序脚本中设置NLS_LANG(正确的设置是AMERICAS_AMERICA.AL32UTF8)不起作用.必须将其导出:

I found the answer to this. Apparently, setting NLS_LANG (the correct setting is AMERICAS_AMERICA.AL32UTF8) in the shell script does not work. It must be exported:

export NLS_LANG=AMERICAN_AMERICA.AL32UTF8