Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1017469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:42:34+00:00 2026-05-16T10:42:34+00:00

My source XML has the copyright character in it as © . When writing

  • 0

My source XML has the copyright character in it as ©. When writing the XML with this code:

var stringWriter = new StringWriter();
segmentDoc.Save(stringWriter);
Console.WriteLine(stringWriter.ToString());

it is rendering that copyright character as a little “c” with a circle around it. I’d like to preserve the original code so it gets spit back out as ©. How can I do this?

Update: I also noticed that the source declaration looks like <?xml version="1.0" encoding="utf-8"?> but my saved output looks like <?xml version="1.0" encoding="utf-16"?>. Can I indicate that I want the output to still be utf-8? Would that fix it?

Update2: Also, &#x00A0; is getting output as ÿ. I definitely don’t want that happening!

Update3: &#x00A7; is becoming a little box and that is wrong, too. It should be §

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:42:35+00:00Added an answer on May 16, 2026 at 10:42 am

    I strongly suspect you won’t be able to do this. Fundamentally, the copyright sign is &#x00A9; – they’re different representations of the same thing, and I expect that the in-memory representation normalizes this.

    What are you doing with the XML afterwards? Any sane application processing the resulting XML should be fine with it.

    You may be able to persuade it to use the entity reference if you explicitly encode it with ASCII… but I’m not sure.

    EDIT: You can definitely make it use a different encoding. You just need a StringWriter which reports that its “native” encoding is UTF-8. Here’s a simple class you can use for that:

    public class Utf8StringWriter : StringWriter
    {
        public override Encoding Encoding
        {
             get { return Encoding.UTF8; }
        }
    }
    

    You could try changing it to use Encoding.ASCII as well and see what that does to the copyright sign…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 498k
  • Answers 498k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer See this MSDN article - Adding Business Logic By Using… May 16, 2026 at 12:11 pm
  • Editorial Team
    Editorial Team added an answer Ah, selinux :D The paths that were not getting loaded… May 16, 2026 at 12:11 pm
  • Editorial Team
    Editorial Team added an answer You probably want to use teh default entry point functions.… May 16, 2026 at 12:11 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Apparently, BDB-XML has been around since at least 2003 but I only recently stumbled
For an XML that has <?xml version=1.0 encoding=utf-8?> <COLLADA version=1.4.0 xmlns=http://www.collada.org/2005/11/COLLADASchema> <library_geometries> <geometry id=Cube>
Our team has just moved from Netbeans to IntelliJ 9 Ultimate and need to
I have an application that reads XML information about a vehicle title and parses
I am using CakePHP for my project, and I am generating XML views so
I have a org.w3c.dom.Node object. I would like to see if it has any
Eclipse's problems tab is displaying this error: Description: Java compiler level does not match
In reading this recent question about an unhandled XmlException, I tried to reproduce it
I have a page on my ASP.NET site that has a Repeater control to
I'm querying Sharepoint server-side and getting back results as Xml. I want to slim

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.