I’m using a List Custom Setting to allow some attributes used in Apex code to be configured for each picklist entry of a field. So it is natural to make the “Name” of the setting correspond to one of the picklist entries, and then add custom fields to hold the attributes. But a gotcha with this approach is the length of what can be stored in the “Name” field.
First of all the “Name” field reports its length in e.g. the schema browser in Eclipse as 38 characters. But if you hard code that assumption – e.g. truncate any field you are trying to match to 38 characters – you are still at risk of a second problem. That second problem is that the length limit applies to the URL encoded form of the text being entered for the “Name” (confirmed by Salesforce support).
For example this 7 character string:
A/B 'C' 1234567
consumes 13 of the available 38 characters in its URL encoded form:
Note that apart from the length problem this encoding is not visible to code using the custom setting i.e. Apex code always sees the unencoded form.