c# - Code First issue with seeding data in cyrilic -


i using seed method populate database. of objects have properties in cyrillic. example:

context.wines.addorupdate(new wine()        {            id = 1,            name = "Шардоне",            etc........................................ 

the objects created in database, when check database in ms sql management studio instead of wine's name being "Шардоне", displayed "Øàðäîíå".

strangely, when create wine in startup class this:

var db = new winesystemdbcontext(); var shardonewine = new wine { name = "Шардоне}; db.wines.add(shardonewine); 

everything displayed in cyrillic in database.

do have idea may cause this?

you can specify charset of connectin in connection string. add part connection:

charset=utf8; 

if no results can try change char-set of configuration.cs file. there 2 ways that.

  1. close configuration.cs in visual studio editor, right-click on file in solution explorer , select "open with..." -> "csharp editor encoding" , list choose "unicode (utf-8 signature) - codepage 65001" option (try other codepage if 1 show 'chinese' symbols). fix cyrilic chapters , save configuration.cs file.
  2. select "file" -> "advanced save options" , save file method seed data utf-8 encoding.

you can have problems if using ntext column type.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -