core/codecs: implement AllocatorError -> EncoderError conversion