Add more restrictions to custom attribute encoding