Organize normalize_encoding_params' conditionals a bit better and use a case statement for it

Refactor of the work done in #11891