7

Actually before i did not use framework or linq, just type in sql statement with Sqlcommand class, i type in insert into table values(N'sample') actually i donot know what is N, but it works for Chinese and other Language, otherwise, it will insert some question mark.

But when i use EntityFramework,this kind of framework always insert some question mark, can i ask how to tackle the issue.

N means Unicode? Can you give me one example that EntityFramework use that sort of thing?

stackover
  • 122
  • 1
  • 7
  • BTW, I tested EF with Hebrew in it works just fine. Does Chinese included in the unicode? – gdoron Sep 28 '12 at 02:16
  • 1
    It may depend on how the database looks like. If you are using SQL Server - are your columns nvarchar or nchar? In EF the string property needs to have Unicode set to true. Are you using CodeFirst or Database/Model first? – Pawel Sep 28 '12 at 03:39
  • 1
    You need to provide more information about your mapping and database. – Ladislav Mrnka Sep 28 '12 at 09:54

4 Answers4

5
  1. in .edmx Table, select column -> check its properties and set unicode to true
  2. re-generate table if you are working in Code First Apporach
  3. check your database table, it should be nvarchar or ntext datatype

this way EF will save unicode characters.

enter image description here

Saboor Awan
  • 1,567
  • 4
  • 24
  • 37
2

I had exact same problem for Nepali Language. I had to convert the datatype of sql server column from varchar to nvarchar and then refresh my *.edmx file in entity framework mapping. Then it worked fine.

varchar(255) => nvarchar(255)

varchar(MAX) => nvarchar(MAX)

Right click on that table mapping in edmx file and refresh. Save the changes.

merazuu
  • 4,118
  • 6
  • 18
  • 19
0

Make sure you have the language packs installed on the server that holds sqlserver for Chinese.

DRobertE
  • 3,478
  • 3
  • 26
  • 43
0

we just changed the datatype to nchar() or nvarchar and it worked. It was able to store the data in any language other then English.