For a javascript based SharePoint application, I noticed that the internal name of columns with spaces are encoded. When updating these fields using the Javascript Rest API my data needs to include the field names as encoded values. For example, a column with the name "Item Status" is encoded to "Item_x0020_Status". Is there a list of all characters that encoded to these unicode values? Or the inverse (list of characters not encoded)?

Ultimately I would like to build some sort of function or regular expression that captures and replaces encoded characters with their respective values.

  • This might help: n8d.at/blog/… – SharePointer Jan 29 '18 at 22:08
  • This was a good example. Though I have a question as to why you would use 'escape' instead of 'encodeURICompoent'? – Wanderer Jan 31 '18 at 13:53

It's going to be a little more complicated than that. The internal name, set when the column is created, isn't always the encoded value of the current display name.

If the display name hasn't been changed, you are right, 'Item Status' has an internal name of 'Internal_x0020_Status'.

Most special characters not alphabetic/numeric will be encoded. If you can ensure your list column display names match the internal name things might work.

However, there are some gotchas.

  1. If a field is created with a beginning number - example '4th Quarter', the internal name would be _x0034_th_x0020_Quarter. Also, I've seen posts where a beginning letter is encoded, for what reason I don't know.
  2. Also, a field's display name can be changed - what might have an internal name of 'Item_x0020_Status' might very well have a display name of 'Current Item Status', so if you encoded the display name it would still be incorrect.
  3. Another issue - an internal field name might have a limit of 32 characters, so the internal name might be truncated.

You'd have to account for all of that besides the physical encoding (which could be done with an XML conversion function.

To be totally generic, you'd have to use the REST api to get the internal names you need, then use those to do your update. Or if you use SPServices you can use SPService calls to $().SPServices.SPGetStaticFromDisplay http://sympmarc.github.io/SPServices/utilities/SPGetStaticFromDisplay.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.