Encode and decode id parts so that any strings can be used