Using the right encoding and fialing for the right code