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.

3 thoughts on “Escape and Unescape Internal Names

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>