Yoramo <yo****@gmail.com> wrote:
I'm generating a XML document to a StringWriter. using VS 2005 beta 1.
I have 2 problems:
1. I can not set the encoding to UTF-8. I'm getting UTF-16 all the
time..
Try the following class:
public class StringWriterWithEncoding : StringWriter
{
Encoding encoding;
public StringWriterWithEncoding (Encoding encoding)
{
this.encoding = encoding;
}
public override Encoding Encoding
{
get { return encoding; }
}
}
That way you can tell the StringWriter what encoding you want it to
advertise itself as.
2. The XML document is missing its end. is there a limit to the size
of the StringWriter?
Well, there's *some* limit, but it's unlikely you're hitting it.
Could you post a short but complete program which demonstrates the
problem?
See
http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too