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.

Advertisement
Escape and Unescape Internal Names

3 thoughts on “Escape and Unescape Internal Names

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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