1

I have strings in my MsSql database with nvarchar column type. My seed method sample is this:

protected override void Seed(Sro.Models.ApplicationDbContext db)
    {
        Konu iyimi = new Konu { isim ="ıyımıdır", lastAktifTime = DateTime.Now, konuUrl = "iyimi", };
        db.Konu.AddOrUpdate(iyimi);
    }

when I execute the seed method some characters "ç, ö" are okay but "ı" character saving as "ý" in database, for example "ıyımıdır" appears "ýyýmýdýr". I tried differen sql servers but the result is same. By the way there's no problem with website queries. When I try to add new row when debugging it is okay. It doesn't make any sense to me. Thanks for any help.

5
  • Did you checked sql query by profiler? Commented Sep 26, 2015 at 18:58
  • No, I didn't, do I need to ? Commented Sep 26, 2015 at 19:01
  • 4
    Is the C# source file utf-8 encoded? Commented Sep 26, 2015 at 20:25
  • for some reason it was converted to ANSII or something else. I changed file encoding with Notepad++ now it works. Commented Sep 26, 2015 at 22:38
  • File->Advanced Save Options Encoding: Unicode(utf8) Commented Oct 28, 2017 at 2:37

2 Answers 2

1

Add "Charset=utf8" to entity connection string.

Entity Framework C# Insert Data russian encoding problems

Sign up to request clarification or add additional context in comments.

Comments

0

Try add 'N' before string eg: UPDATE TableName SET Name = N'śćżas' WHERE Id = 0

1 Comment

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.