If you’re a SharePoint Dev you’re bound to come across the curious escaping used in some text. Text like:
Gets encoded to:
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:
- System.XML.XmlConvert.EncodeName() to encode
- System.XML.XmlConvert.DecodeName() to decode
Both are static.
3 thoughts on “Escape and Unescape Internal Names”
More info here http://www.davehunter.co.uk/Blog/Lists/Posts/Post.aspx?ID=95
Damn, I wish I’d read that a year ago!
Damn, I wish I’d read that 2 years ago!