Skip to content
Myr

✨ Support cp850 encoding for auto-completion in PowerShell (#808)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sofie Van Landeghem · committed by GitHub · parent 03ea87a · Browse files · 1 file+8 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−8 removed

  • other:+8 added−8 removed

1 file+8 added−8 removed

modified:typer/_completion_shared.py+8 added-8 removed
181 unmodified lines
182 path_str = ""183 if isinstance(result.stdout, str): # pragma: no cover184 path_str = result.stdout185 if isinstance(result.stdout, bytes):186 try:187 # PowerShell would be predominant in Windows188 path_str = result.stdout.decode("windows-1252")189 except UnicodeDecodeError: # pragma: no cover186 for encoding in ["windows-1252", "utf8", "cp850"]:187 try:191 path_str = result.stdout.decode("utf8")192 except UnicodeDecodeError:193 click.echo("Couldn't decode the path automatically", err=True)194 raise188 path_str = result.stdout.decode(encoding)189 break190 except UnicodeDecodeError: # pragma: no cover191 pass192 if not path_str: # pragma: no cover193 click.echo("Couldn't decode the path automatically", err=True)194 raise click.exceptions.Exit(1)195 path_obj = Path(path_str.strip())196 parent_dir: Path = path_obj.parent197 parent_dir.mkdir(parents=True, exist_ok=True)198 script_content = get_completion_script(
42 unmodified lines