Improving the Writer class for trying to avoid encoding problems....