Hi!
I am receiving from some dll (which is wrapper for some external data source) strings in Windows-1250 codepage and I would like to insert them correctly (as unicode) to table in SQL Server Database. Since particular row in database which should hold that data is of NVarchar type, I only needed to convert it in my C# code to unicode and pass it as parameter. Everything is well and nice, but I stumbled on conversion step.
I tried the following but that doesn't work:
private static String getUnicodeValue(string string2Encode) //
{
Encoding srcEncoding = Encoding.GetEncoding("Windows-1250");
UnicodeEncoding dstEncoding = new UnicodeEncoding();
byte[] srcBytes = srcEncoding.GetBytes(string2Encode);
byte[] dstBytes = dstEncoding.GetBytes(string2Encode);
return dstEncoding.GetString(dstBytes);
}
When I insert this returned string to table, I don't get correct letters like Đ, đ, Č, č, Ć or ć.
Please, help! :)