Added Unicode exception handling to writer.