Process string to encode