Essay encode

This is the pg  counterpart to webwork2 pull request 164