Convert string to proper value for codec.