2011-02-18 119 views
1

我有一個連接到MySql數據庫的asp.net頁面。插入希伯來語字符到MySql數據庫

當我嘗試從網頁插入/更新值到DB 字符在數據庫中顯示爲問號(我正在使用SP)。 如果我會直接在DB中寫入查詢,它將起作用,並且字符 將正確顯示。

數據庫默認字符集是utf8,列整理是utf8_general_ci。

10X很多&週末愉快:)

+0

什麼是網頁的編碼? – briantyler 2011-02-18 16:23:45

回答

5

最終什麼解決了我的問題是將CharSet = utf8添加到連接字符串。

10x alot everyone :)

1

我相信你的C#字符串被視爲統一的,而不是UTF8

從片斷一些示例代碼,前一段時間我發現:

System.Text.Encoding utf_8 = System.Text.Encoding.UTF8; 

// This is our Unicode string: 
string s_unicode = "abcéabc"; 

// Convert a string to utf-8 bytes. 
byte[] utf8Bytes = System.Text.Encoding.UTF8.GetBytes(s_unicode); 

// Convert utf-8 bytes to a string. 
string s_unicode2 = System.Text.Encoding.UTF8.GetString(utf8Bytes); 

MessageBox.Show(s_unicode2);