Home > database >  C # SQL insert special characters
C # SQL insert special characters

Time:10-01

Have a customer need to fill in a special name:? А? ж о л?? р ы л ы с?

C # the background track, found that after the HtmlEncode is & amp; # 171; А? ж о л?? р ы л ы с & amp; # 187;

At this moment, and there is no problem, but when saved to the database, became & amp; # 171; А? ж о л?? р ы л ы с & amp; # 187;

That is to say? And???? Becomes a question mark?

Coding format is utf-8

Did not come across this problem before, troublesome everybody a great god help going to do with this?

CodePudding user response:

Try changing the field type to nvarchar

CodePudding user response:

The
reference 1/f, February 16 response:
change the field type to nvarchar try

After the type of existing data before what is the effect?

CodePudding user response:

refer to the second floor hk207 response:
Quote: reference 1/f, February 16 response:

Try changing the field type to nvarchar

After the type of existing data before what is the effect?

Specific depends on what is the type of before, the original poster can add up a column, type nvarchar, then make a list of data is copied to this before, and see whether have problem

CodePudding user response:

The former type is varchar

CodePudding user response:

The
reference 1/f, February 16 response:
change the field type to nvarchar try


Well, if a new nvarchar fields, save the & amp; # 171; А? ж о л?? р ы л ы с & amp; # 187; Display is normal, but the use of the original varchar field to nvarchar type, save or the same? And???? Becomes a question mark?

What reason is this?

CodePudding user response:

reference 5 floor hk207 reply:
Quote: reference 1/f, February 16 response:

Try changing the field type to nvarchar


Well, if a new nvarchar fields, save the & amp; # 171; А? ж о л?? р ы л ы с & amp; # 187; Display is normal, but the use of the original varchar field to nvarchar type, save or the same? And???? Becomes a question mark?

What reason is this?

Change after, the newly saved? Or the former old data?

CodePudding user response:

To save or will become?

CodePudding user response:

At the same time save the two fields, one is new nvarchar fields, one is the original varchar type, instead of nvarchar type field, add this field to keep normal, the original field or show up as?

CodePudding user response:

  • Related