Click here to Skip to main content
15,890,724 members
Home / Discussions / C#
   

C#

 
Questionnotification Pin
ellllllllie16-May-08 1:38
ellllllllie16-May-08 1:38 
AnswerRe: notification Pin
originSH16-May-08 1:39
originSH16-May-08 1:39 
AnswerRe: notification Pin
Pete O'Hanlon16-May-08 2:06
mvePete O'Hanlon16-May-08 2:06 
Questionproblems in checklistbox Pin
Amitava Dutta16-May-08 1:05
Amitava Dutta16-May-08 1:05 
AnswerRe: problems in checklistbox Pin
Christian Wikander16-May-08 2:25
Christian Wikander16-May-08 2:25 
QuestionHow can i read print content (print document data) from a Job using PrintQueueStream [modified] Pin
Krishna Prasad RVS16-May-08 0:38
Krishna Prasad RVS16-May-08 0:38 
QuestionXML encoding issue Pin
George_George16-May-08 0:11
George_George16-May-08 0:11 
AnswerRe: XML encoding issue Pin
mlsteeves16-May-08 3:48
mlsteeves16-May-08 3:48 
Looking at msdn documenation: http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.createxmldeclaration.aspx[^]

The section about encoding says,

"The value of the encoding attribute. This is the encoding that is used when you save the XmlDocument to a file or a stream; therefore, it must be set to a string supported by the Encoding class, otherwise Save fails. If this is nullNothingnullptra null reference (Nothing in Visual Basic) or String.Empty, the Save method does not write an encoding attribute on the XML declaration and therefore the default encoding, UTF-8, is used.

Note: If the XmlDocument is saved to either a TextWriter or an XmlTextWriter, this encoding value is discarded. Instead, the encoding of the TextWriter or the XmlTextWriter is used. This ensures that the XML written out can be read back using the correct encoding. "


So I would guess that the "note" applies in your case. Your StringWriter that you are saving to is causing the encoding value to be ignored. (I imagine that the underlying StringBuilder is using UTF-16 strings)

If you were to use the XmlTextWriter, then you can specify the encoding that you want.
GeneralRe: XML encoding issue Pin
George_George16-May-08 4:49
George_George16-May-08 4:49 
GeneralRe: XML encoding issue Pin
mlsteeves16-May-08 5:22
mlsteeves16-May-08 5:22 
GeneralRe: XML encoding issue Pin
George_George16-May-08 20:37
George_George16-May-08 20:37 
GeneralRe: XML encoding issue Pin
mlsteeves20-May-08 1:55
mlsteeves20-May-08 1:55 
GeneralRe: XML encoding issue Pin
George_George20-May-08 3:55
George_George20-May-08 3:55 
GeneralRe: XML encoding issue Pin
PIEBALDconsult16-May-08 5:52
mvePIEBALDconsult16-May-08 5:52 
GeneralRe: XML encoding issue Pin
George_George16-May-08 20:39
George_George16-May-08 20:39 
GeneralRe: XML encoding issue Pin
PIEBALDconsult17-May-08 4:01
mvePIEBALDconsult17-May-08 4:01 
GeneralRe: XML encoding issue Pin
George_George17-May-08 4:13
George_George17-May-08 4:13 
GeneralRe: XML encoding issue Pin
PIEBALDconsult17-May-08 7:58
mvePIEBALDconsult17-May-08 7:58 
GeneralRe: XML encoding issue Pin
George_George17-May-08 21:33
George_George17-May-08 21:33 
GeneralRe: XML encoding issue Pin
PIEBALDconsult18-May-08 4:48
mvePIEBALDconsult18-May-08 4:48 
GeneralRe: XML encoding issue Pin
George_George20-May-08 3:51
George_George20-May-08 3:51 
GeneralRe: XML encoding issue Pin
PIEBALDconsult20-May-08 14:16
mvePIEBALDconsult20-May-08 14:16 
GeneralRe: XML encoding issue Pin
George_George20-May-08 22:53
George_George20-May-08 22:53 
QuestionSend Object By Value? Pin
Harvey Saayman16-May-08 0:08
Harvey Saayman16-May-08 0:08 
AnswerRe: Send Object By Value? Pin
Vikram A Punathambekar16-May-08 0:13
Vikram A Punathambekar16-May-08 0:13 

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.