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 7579483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:41:32+00:00 2026-05-30T17:41:32+00:00

Possible Duplicate: Why are “control” characters illegal in XML? Saving an escape character 0x1b

  • 0

Possible Duplicate:
Why are “control” characters illegal in XML?
Saving an escape character 0x1b in an XML file

This throws an ArgumentException:

    var c = '\x1A';

    var xml = new XDocument(
                new XDeclaration("1.0", "utf-8", null),
                new XElement("test", new XCData(c.ToString()))
            );

    var foo = xml.ToString(); // ArgumentException

Why is .Net throwing this exception? I’m wrapping the illegal character in CDATA, so I would have thought that illegal characters would be handled for me. This is also the case for a bunch of other characters (e.g. 0x1B, 0x1C, 0x1E, 0x1E, 0x1F).

How do you work around this problem?

  • 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-30T17:41:33+00:00Added an answer on May 30, 2026 at 5:41 pm

    I don’t think SecurityElement.Escape will work because \x1A is a control code — there’s no valid xml entity to substitute.

    See this list of valid XML characters for a bit more detail.

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

Sidebar

Related Questions

Possible Duplicate: “Least Astonishment” in Python: The Mutable Default Argument Edit: This has nothing
Possible Duplicate: setTimeout and “this” in JavaScript I am trying to put a timeout
Possible Duplicate: “No newline at end of file” compiler warning i am a Linux
Possible Duplicate: Weird “406 not acceptable” error I've been stuck on this ALL DAY!
Possible Duplicate: How to disable “Security Alert” window in Webbrowser control I'm currently using
Possible Duplicate: Why does “abcd”.StartsWith(“”) return true? Something similar to this being true caught
Possible Duplicate: “Invalid use of 'this' in non-member function” in objective-c context? If I
Possible Duplicate: “Least Astonishment” in Python: The Mutable Default Argument This is very odd,
Possible Duplicate: Are “(function ( ) { } ) ( )” and “(function (
Possible Duplicate: Weird “406 not acceptable” error following code generate a 406 Not Acceptable

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.