Fixing Unicode problem for writing files - UTF-8 support only