Re: Sql server to xml string with encoding
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 06/22/04
- Next message: Mike Williams: "Re: SQL Connection Pool stops AppDomain unloading"
- Previous message: Paul Clement: "Re: Behavior of EnlistDistributedTransaction(null)"
- In reply to: Urban Andersson: "Re: Sql server to xml string with encoding"
- Next in thread: Per Bolmstedt: "Re: Sql server to xml string with encoding"
- Reply: Per Bolmstedt: "Re: Sql server to xml string with encoding"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 22 Jun 2004 14:38:21 +0100
Urban Andersson <anderssonurban@hotmail.com> wrote:
> But the data is stored in ISO-8859-9 in the database. Is it not correct the
> to set the stream to ISO-8859-9 so that the data will be converted to that
> encoding when writing to the stream instead of UTF-8 wich the data is not?
> It seems to me that the WriteXml method writes UTF-8 to the stream instead
> of ISO-8859-9?
It doesn't matter how the data is stored in the database - by the time
it's been fetched from the database, it's just Unicode text, assuming
you've got it in text fields in the database. If it's a text field, the
data is just text data. It doesn't intrinsically have an encoding -
that's an implementation detail for storage, effectively.
See http://www.pobox.com/~skeet/csharp/unicode.html and
http://www.pobox.com/~skeet/csharp/debuggingunicode.html for more
information.
> I tried using the StringWriter but i am not able to set
> the encoding.
As I said, you need to subclass StringWriter in order to specify an
encoding. You basically override the Encoding property.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Mike Williams: "Re: SQL Connection Pool stops AppDomain unloading"
- Previous message: Paul Clement: "Re: Behavior of EnlistDistributedTransaction(null)"
- In reply to: Urban Andersson: "Re: Sql server to xml string with encoding"
- Next in thread: Per Bolmstedt: "Re: Sql server to xml string with encoding"
- Reply: Per Bolmstedt: "Re: Sql server to xml string with encoding"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|