An Sql Server 2000 table for our website has a "text" field (not "ntext"), where our users insert content in various languages (Korean and Chinese are popular). In regular old ASP/ADO, I'd select then response.write the data, and it would render correctly in a web browser.
Now as I convert our website to ASP.NET/ADO.NET, selecting the same field returns garbage to the web browser. I'd like to know a way around this; a way to exhibit the same behavior as in regular ASP. It seems like ADO.NET is reading the bytes of the UTF-8 field as Unicode and then converting them straight to text. I need to access the bytes in the DataSet or SqlDataReader before the "mangle" occurs. Changing the field to "ntext" might help, but unfortunately, this is not an option. I've tried setting the response encoding and codepage, which doesn't help. Its important to note that iterating over the SqlDataReader's GetBytes function DOES work, but this is very unwieldy to use in production. And besides, there is no analogous GetBytes method for a DataSet. So I'm at an impasse here. This looks like an ADO.NET issue, but I can't find anything about ADO.NET and encodings. I need to know 2 things: 1) what's going on? (Is my UTF-8/Unicode assessment correct)? 2) how do I get around this? (I need a solution that spans both SqlDataReaders and DataSets). Thanks in advance! Monsur You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
