468,135 Members | 1,410 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,135 developers. It's quick & easy.

writing the " © " character in xml file using c#.net xmltextwriter

Hi,

I have a doubt related to xml. I want to print the copyright “©” symbol … but I wan to do it programmatically and without using the symbol directly. Hence I am using the ASCII value (© ) for that instead of the actual character.

Sample code for it is as follows.

XmlTextWriter xtw = new XmlTextWriter("test.xml", Encoding.UTF8);
xtw.WriteStartElement("root");
xtw.WriteString("(©) " + DateTime.Now.Year.ToString() +All rights reserved.");
xtw.WriteFullEndElement();
xtw.Close();

however it gives the below output.

<root>&amp;#169; 2007 All rights reserved.</root>


But I want the output to come as follows.

<root> © 2007 All rights reserved.</root>


Let me know where I am going wrong.

-Anil
Jun 19 '07 #1
1 2690
Dököll
2,364 Expert 2GB
Hi,

I have a doubt related to xml. I want to print the copyright “©” symbol … but I wan to do it programmatically and without using the symbol directly. Hence I am using the ASCII value (© ) for that instead of the actual character.

Sample code for it is as follows.
Expand|Select|Wrap|Line Numbers
  1. XmlTextWriter xtw = new XmlTextWriter("test.xml", Encoding.UTF8);
  2.             xtw.WriteStartElement("root");
  3.             xtw.WriteString("(©)  " + DateTime.Now.Year.ToString() +All rights reserved.");
  4.             xtw.WriteFullEndElement();
  5.             xtw.Close();
  6.  
however it gives the below output.

<root>&amp;#169; 2007 All rights reserved.</root>


But I want the output to come as follows.

<root> © 2007 All rights reserved.</root>


Let me know where I am going wrong.

-Anil
Have you tried removing the parenthesis?

I'll give it a go when I have a minute!
Jun 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by barney | last post: by
1 post views Thread by Dan | last post: by
7 posts views Thread by GS | last post: by
3 posts views Thread by lisa.bogart | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.