我想在oracle数据库(10 g)中保存unicode数据(希腊语).我创建了一个简单的表:
alt text http://i25.tinypic.com/dvpqnk.png
我知道NVARCHAR2总是使用UTF-16编码,所以它必须适用于所有(人类)语言.
然后我试图在数据库中插入一个字符串.我在代码中硬编码了字符串("你好吗?").然后我尝试从数据库中恢复并显示它.
class Program
{
static string connectionString = "<my connection string>";
static void Main (string[] args) {
string textBefore = "?? ??????;";
DeleteAll ();
SaveToDatabase (textBefore);
string textAfter = GetFromDatabase ();
string beforeData = String.Format ("Before: {0}, ({1})", textBefore, ToHex (textBefore));
string afterData = String.Format ("After: {0}, ({1})", textAfter, ToHex (textAfter));
Console.WriteLine (beforeData);
Console.WriteLine (afterData);
MessageBox.Show (beforeData);
MessageBox.Show (afterData);
Console.ReadLine ();
}
static void DeleteAll () {
using (var oraConnection = new OracleConnection (connectionString)) …Run Code Online (Sandbox Code Playgroud)