Matrix001
Matrix001

Reputation: 1272

How do you encode Hebrew characters to a database without getting "????"

When I insert Hebrew words to the database, I get ????? marks after i click "show Table" in Server Explorer.

Is there a way to Encode the hebrew letters before they go in?

 sqlCommand.Parameters.Add("@HebrewLettersEncoded", SqlDbType.VarChar, 50);
        sqlCommand.Parameters["@HebrewLettersEncoded"].Value = HebrewLettersTextBox1Output.Text;

I am thinking that there should be some encoder that will encode - HebrewLettersTextBox1Output.Text

Upvotes: 1

Views: 1226

Answers (2)

RThomas
RThomas

Reputation: 10882

You'll need to make sure the field you are trying to put the characters into is an NVarChar (not varchar). Then change the code above to....:

 sqlCommand.Parameters.Add("@HebrewLettersEncoded", SqlDbType.NVarChar, 50);

Upvotes: 2

P Daddy
P Daddy

Reputation: 29527

You'll want an nvarchar field instead of a varchar. Hebrew characters aren't in plain ASCII, so you'll need unicode to represent them, unless you want to do ugly code page selection.

Upvotes: 1

Related Questions