[PR] #294 from luna-1024: Fix windows utf8

Support unicode ascii art on Windows
This commit is contained in:
Azalea 2024-05-25 01:27:24 +08:00 committed by GitHub
commit 109d7d2f01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -344,7 +344,7 @@ def run_neofetch(asc: str, args: str = ''):
with TemporaryDirectory() as tmp_dir: with TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir) tmp_dir = Path(tmp_dir)
path = tmp_dir / 'ascii.txt' path = tmp_dir / 'ascii.txt'
path.write_text(asc) path.write_text(asc, 'utf-8')
# Call neofetch with the temp file # Call neofetch with the temp file
if args: if args:
@ -378,7 +378,7 @@ def run_fastfetch(asc: str, args: str = '', legacy: bool = False):
with TemporaryDirectory() as tmp_dir: with TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir) tmp_dir = Path(tmp_dir)
path = tmp_dir / 'ascii.txt' path = tmp_dir / 'ascii.txt'
path.write_text(asc) path.write_text(asc, 'utf-8')
# Call fastfetch with the temp file # Call fastfetch with the temp file
proc = subprocess.run([ff_path, '--raw' if legacy else '--file-raw', path.absolute(), *shlex.split(args)]) proc = subprocess.run([ff_path, '--raw' if legacy else '--file-raw', path.absolute(), *shlex.split(args)])