Improved Unicode handling and logging.