in Umbraco

hexadecimal value 0x1F, is an invalid character publishing content in Umbraco

I was adding some content into a Umbraco content page when I attempted to publish the page I got a 500 error with the following error message:

1
2
3
4
5
6
7
8
9
10
Server Error in '/' Application.

'', hexadecimal value 0x1F, is an invalid character. Line 1, position 519.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: '', hexadecimal value 0x1F, is an invalid character. Line 1, position 519.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

The issue was because of a special/invalid character in the content. This may be caused by copy and paste from a application like Microsoft Word or a similar word processing application. The best way to get around this is to paste the content into a application like Notepad or Notepad++ and then find the invalid character, replace the character and then copy/paste into Umbraco.