Move Encoding helper into corelib from spec_helper