Added support for encoding in a web worker.