safe_str now supports argument isatty that if set to false uses the filesystem encoding