improve kludge collector in `.encodingFromHeader`