Hi all,
I have a problem showing Chinese characters on a web page. I have tried everything, I searched the internet and found lots of information, but to no avail. All I get is little boxes instead of characters. I can display characters typed directly into the page, but not from the database.
Thanks in advance, I hope this description describes the problem in enough detail,
Lee BlakePosted Sep 11, 2007, 8:58 AM
Yes the column is nvarchar and the code I was given to work from is given below:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection sqlConnection = new SqlConnection("Data Source=db4;Initial Catalog=db;UID=bd;PWD=bd;Max Pool Size=200;");
sqlConnection.Open();
byte[] bytes = HttpUtility.UrlDecodeToBytes("%BD%BB%D2%D7%D4%B1", Encoding.UTF8);
string s = "BDBBD2D7D4B1";
SqlCommand command = new SqlCommand("SELECT CAST(0x"+s+" as nvarchar(100))", sqlConnection);
SqlDataReader reader = command.ExecuteReader();
reader.Read();
Response.Write(reader.GetString(0));
reader.Close();
sqlConnection.Close();
}
This is not my code!!
Jan MontanoPosted Sep 11, 2007, 6:19 AM
And how do you retrieve/display it on the webpage?