Better support for Unicode.

Reading files for R scripts now allows selection of an encoding.
Perform Unicode en/decoding only on file read/write. Provide better
information on the text that is causing a Unicode error.