Add a replacement encoder factory based on types; make sure that it returns the same answer for all tested types.