Add encoding support to corpus and document classes.