common encoder helper superclass