encode messages in typemaps