在oracle db中插入波斯字符时,我看到了问号 [英] when insert persian character in oracle db i see the question mark

查看:74
本文介绍了在oracle db中插入波斯字符时,我看到了问号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将oracle与c#一起使用,将嵌入的c#代码插入,并插入列(NVARCHAR2)并使用 N个字符串". 将其插入正确无误的机器中,但是在服务器(另一台机器)上运行我的应用程序时,我看到问号(????).

I use the oracle with c#, i insert embedded in c# code , and my column(NVARCHAR2) and use N 'string'. when insert in my machine that's correct and OK, but when run my app in sever (another machine) I see the question mark(????).

推荐答案

当您说在服务器上运行时,是指通过SQL * Plus吗?

When you say you run on the server, you mean through SQL*Plus?

首先要检查的是要存储的实际字符-使用DUMP函数进行检查:

First thing to check is what actual character is being stored - use the DUMP function to check this:

Oracle转储函数

这将告诉您实际存储了什么.如果客户端应用程序与Oracle服务器之间的链条不合适,则可能会发生字符集转换.

This will tell you what is actually stored. If the chain between your client app and Oracle server is not appropriate you might get character set conversion occurring.

假设保存了正确的字符,那么您在服务器/sqlplus上看到的就是显示的字符转换. IE. Oracle正确地保留"了该字符,但是显示未按您期望的那样处理它.要解决此问题,您需要将NLS_LANG环境变量设置为正确的字符集.

Assuming the correct character is being saved, what you then see on the server / sqlplus is character conversion on display. I.e. Oracle is "serving up" the character correctly, but the display is not handling it as you expect. To fix this, you need to set the NLS_LANG environment variable to the correct character set.

例如,在最近的项目中,默认值:

e.g., in a recent project the default:

set NLS_LANG=AMERICAN_AMERICA.US7ASCII

然后查询一些数据:

NAME
-----------------------------------
MS ELLIE MARTALL

但是:

set NLS_LANG=AMERICAN_AMERICA.US8PC437

然后运行查询给出:

NAME
-----------------------------------
MS ÉLLIE MARTALL

还有:

set NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P15

给予:

NAME
-----------------------------------
MS ╔LLIE MARTALL

这里的关键是实际数据是相同的,这是因为在显示器上呈现数据的方式有所不同,并且行为可以由NLS_LANG控制.

The key thing here is the actual data is the same, it's the way that data is being presented on your display is what differs, and that behavior can be controlled by NLS_LANG.

这篇关于在oracle db中插入波斯字符时,我看到了问号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆