SharePoint’s weird column names

It is a well-known fact that SharePoint encodes special symbols in column names for it’s internal use. For example all the spaces are replaced with _x0020_

However on some occasions even a valid letters in the beginning of the name are encoded. For example: “Col1” becomes “_x0043_ol1”. It was pointed in a online discussion that if the column name resembles the Excel’s “A1 notation”, it get’s encoded.

The issue that I was experiencing was exactly with the example above. If I tried to use the internal name in a REST query it ended up with an error. The possible values that I tried were: “Col1”, “_x0043_ol1” or “%5Fx0043%5Fol1” all with the same result – error 400.

Solution was to query all items of the list and extract the name of the column from the response. To my surprise the column in question was encoded as “OData__x0043_ol1“.  Using this name started to get me the correct responses from the REST query. This one was pointed out to me in a Stack Overflow question.