Escape and Unescape Internal Names

If you’re a SharePoint Dev you’re bound to come across the curious escaping used in some text. Text like:

Hello World

Gets encoded to:

Hello_x0020_World

So what’s the _x0020_ number about? Well, hex 20 is the UTF value for a space, and x0020 represents that space. I guess the underscores are delimiters. The reason for this escaping is that XML element names can’t have a space.

How would I encode or decode this? Well, the clue is in the phrase ‘XML element names’. You can use:

Both are static.

Escape and Unescape Internal Names

3 thoughts on “Escape and Unescape Internal Names

Leave a reply to Andy Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.