I am extracting information from an MSSQL DB and using VB to manipulate it and output it to text. The problem is that what should appear as 'Gebrüder' is output as 'Gebr?der'. Any ideas on what could cause this?
There are two common reasons for this:
1. You're using a non-Unicode aware font. Try switching to MS Arial Unicode (comes with Office)
2. You're reading data in one encoding (maybe Latin-1) and not running it through an instance of the Encoding family of classes to transform it into Unicode.
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
I didn't realise that I'd have to manually alter the text Encoding, but I have a feeling that it is probably the latter as the characters show up just fine in the VS.NET debugger, but not in the text document. I've just had a flick through the MSDN docs and have found the Encoding Class. Is this what I am after? The DB Collation is Latin1 so would I need to process it?
What's the column type in SQL Server? To store Unicode data it needs to be one of the "N" family: NCHAR NVARCHAR NTEXT.
Your ADO.NET parameter object (if you're using one, and you probably should be for other reasons) needs to be SqlDbType.NChar, SqlDbType.NVarChar, or SqlDbType.NText
Chip H.
____________________________________________________________________ If you want to get the best response to a question, please read FAQ222-2244 first
The type for the problematic fields is nvarchar. I would have imagined that this would be the same in the DataSet which is filled from an Sql DataAdapter.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.