title: Cannot use Turkish characters with Entity Framework
body: <p>We have a large SaaS ASP .NET 4.0 application used internationally. We are slowly migrating our classic ADO dataproviders toward Entity Framework.</p>
  
  <p>We use MS Sql server 2008. For Turkish customers we use a Turkish collation "Turkish_CI_AS" for character columns. I.e. 8 bit varchar fields (we don't use 16bit nvarchar columns)</p>
  
  <p>Now I encountered a problem when I add new objects with EF. Special characters like 'ş' are changed:</p>
  
  <pre><code>    using (TestEntities myEntity = new TestEntities())
      {
                      MyObject test = new MyObject()
                      {
                          TestString = "baş"
                      };
  
                      myEntity.MyObjects.AddObject(test);
                      myEntity.SaveChanges();
      }
  </code></pre>
  
  <p>When I step through with the debugger, "test.TestString" is still "baş" in this line of code:</p>
  
  <pre><code>myEntity.MyObjects.AddObject(test);
  </code></pre>
  
  <p>However in the database the field "TestString" has the value "bas". The 'ş' is saved as a 's' This does not happen with my old dataprovider methods.</p>
  
  <p>How can I add Turkish characters to my database with EF? Anyone has some good suggestions? I tried quite some things but can't figure it out :)</p>
  
  <p>tnx, Frank</p>
  
  <p>edit</p>
  
  <p>running the profiler on a little test setup shows this:</p>
  
  <pre><code>exec sp_executesql N'insert [dbo].[TestObjects]([TestChar])
  values (@0)
  select [TestId]
  from [dbo].[TestObjects]
  where @@ROWCOUNT &gt; 0 and [TestId] = scope_identity()',N'@0 varchar(255)',@0='Bas'
  </code></pre>
  
  <p>apparently sql receives the wrong value, it's really .NET who's responsible.</p>