Mac compatibility and UTF-8 support