Reputation: 19365
For various reasons I'm creating a translation table in my sql server 2008 r2. (This question is not about whether that is a correct / good choice)
This table should store translation for languages like english, german, french. Languages like japanese or chinese might follow shortly.
The table is filled/update by a WinForms application and later shown to customers in an ASP.Net WebApplication.
I'm using the Entity Framework 4 with the Models first (creating entities in the designer to create an create script afterwards)
How do I ensure the correct encoding for the save and read operations in the WinForms and the ASP.Net applications? How must the columnTypes in the database look like?
Apparently I can only use "String" as ColumnType in the EntitityDesigner. Chosing "String" in the designer will translate to nvarchar(max). Is that the correct columnType to store strings of different languages?
I guess adding Charset=utf8; to the connectionString is also necessary.
Setting utf-8 as output type in the ASP.Net application seems logic to me.
Must I set anything else in the WinForms application? Do I need to call some encoding / decoding methods myself? If yes, which one and why?
Have I missed something? Do I need to configure something else?
Upvotes: 4
Views: 868
Reputation: 9668
nvarchar is correct. It stores data in unicode and you do not need to encode/decode anything if you are using utf-8 in your application.
Upvotes: 6