Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
GeneralRe: 'Subclassing' child controls. Is it possible? Pin
David Stone11-Jan-03 5:16
sitebuilderDavid Stone11-Jan-03 5:16 
GeneralQuestion on xml encoding in C# Pin
Bugoy9-Jan-03 10:29
Bugoy9-Jan-03 10:29 
GeneralRe: Question on xml encoding in C# Pin
leppie9-Jan-03 10:46
leppie9-Jan-03 10:46 
GeneralRe: Question on xml encoding in C# Pin
Bugoy9-Jan-03 11:49
Bugoy9-Jan-03 11:49 
GeneralRe: Question on xml encoding in C# Pin
leppie9-Jan-03 12:05
leppie9-Jan-03 12:05 
GeneralRe: Question on xml encoding in C# Pin
leppie9-Jan-03 20:49
leppie9-Jan-03 20:49 
GeneralRe: Question on xml encoding in C# Pin
Bugoy10-Jan-03 8:27
Bugoy10-Jan-03 8:27 
GeneralRe: Question on xml encoding in C# Pin
Stephane Rodriguez.10-Jan-03 22:51
Stephane Rodriguez.10-Jan-03 22:51 
First of all, there is nothing wrong in getting an UTF-16 encoding (aka Unicode) since you are explicitely outputting a string content whose encoding is, by design, stored as Unicode (all string content in .NET is stored as unicode, like Java by the way).

Next to that, you have a System.Xml.TextWriter(string filename, Encoding enc) constructor ready to help you. Why don't you use it ? UTF-8 is the default encoding if you don't provide one. Then simply use your string content through WriteRaw(string) calls.

Just in case you don't want to tweak your current code, you can achieve what you need (again, that's bad use of the classes) by deriving the Xml.XmlTextWriter class and provide this constructor :

public XmlTextWriter_(TextWriter w, Encoding enc) {
  this = new XmlTextWriter_();
  this.textWriter = w;
  this.encoding = enc;
  this.xmlEncoder = new XmlTextEncoder(w, this.encoding);
  this.xmlEncoder.QuoteChar = this.quoteChar;
}



PS : train[^] yourself with these free training courses.
GeneralRe: Question on xml encoding in C# Pin
leppie10-Jan-03 23:12
leppie10-Jan-03 23:12 
GeneralRe: Question on xml encoding in C# Pin
Stephane Rodriguez.10-Jan-03 23:42
Stephane Rodriguez.10-Jan-03 23:42 
GeneralRe: Question on xml encoding in C# Pin
leppie11-Jan-03 0:08
leppie11-Jan-03 0:08 
GeneralRe: Question on xml encoding in C# Pin
Stephane Rodriguez.11-Jan-03 2:02
Stephane Rodriguez.11-Jan-03 2:02 
GeneralSerialization Question Pin
matthias s.9-Jan-03 9:04
matthias s.9-Jan-03 9:04 
GeneralRe: Serialization Question Pin
leppie9-Jan-03 9:23
leppie9-Jan-03 9:23 
GeneralRe: Serialization Question Pin
matthias s.9-Jan-03 11:32
matthias s.9-Jan-03 11:32 
QuestionSerious Coding? Pin
FruitBatInShades9-Jan-03 6:48
FruitBatInShades9-Jan-03 6:48 
AnswerRe: Serious Coding? Pin
David Stone9-Jan-03 8:16
sitebuilderDavid Stone9-Jan-03 8:16 
QuestionHowTo Enumerate a systems DSN's ? Pin
Steve Cox9-Jan-03 5:28
Steve Cox9-Jan-03 5:28 
Questionhow to move the position of selected item in a listbox? Pin
fretre9-Jan-03 4:05
fretre9-Jan-03 4:05 
AnswerRe: how to move the position of selected item in a listbox? Pin
leppie9-Jan-03 6:10
leppie9-Jan-03 6:10 
QuestionHow to assign image pair to toolbar buttons? Pin
Smitha Nishant9-Jan-03 3:09
protectorSmitha Nishant9-Jan-03 3:09 
QuestionHas somebody already finished a Managed DX project? Pin
Zinj8-Jan-03 21:34
sussZinj8-Jan-03 21:34 
AnswerRe: Has somebody already finished a Managed DX project? Pin
leppie8-Jan-03 22:42
leppie8-Jan-03 22:42 
AnswerRe: Has somebody already finished a Managed DX project? Pin
Steve Maier18-Jan-03 17:34
professionalSteve Maier18-Jan-03 17:34 
GeneralDebug Crash / Variable - error: cannot obtain value Pin
kman8-Jan-03 17:25
kman8-Jan-03 17:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.