We're trying to figure out the best way to store and retrieve UTF-8 encoded XML in/from SQL Server 2005. Here are our considerations:
* in our code, we need to operate on UTF-8 encoded XML; we currently use byte arrays to store this XML, since .NET strings are UTF-16 encoded
* the SQL Server XML type is also UTF-16 encoded
* we would like to store our byte arrays in the SQL Server XML type, to (later) benefit from things like full test search on DB level
* we have been experimenting with writing our own XML User Type, as shown in several examples on the web, but they all assume a String as type on the C# side and we have not yet figured out if and how we can map the SQL Server XML type to a C# byte array and how and where the (SQl Server) UTF-16 to (C#) UTF-8 encoding should take place
Is there anyone who has tackled this before and give us some pointers as how to best solve this (UTF-8) C# byte array to (UTF-16) SQL Server XML mapping?
Or does anyone know of another recommended approach for this?
Thanks!
Pascal.
|