Modified encoding handlers to lookup functions from array
Added new tests to confirm BS_BAD_ENCODING returned