Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows encoding bugfix #277

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

matejfroebe
Copy link

Problem: When installing auto-completion in Powershell, the path to
the profile file was decoded with windows-1252 encoding - but such
path didn't exist in my case. The correct encoding was cp850.

Solution:

  • try to decode with cp850 also
  • check if the decoded path exists (checking for UnicodeDecodeError isn't enough)

Problem: When installing auto-completion in Powershell, the path to
the profile file was decoded with windows-1252 encoding - but such
path didn't exist in my case. The correct encoding was cp850.

Solution:
- try to decode with cp850 also
- check if the decoded path exists (checking for UnicodeDecodeError isn't enough)
@svlandeg svlandeg added the os / windows Related to Windows label Apr 21, 2022
@svlandeg svlandeg added bug Something isn't working autocompletion Autocompletion functionality p2 and removed investigate labels Mar 8, 2024
@svlandeg svlandeg marked this pull request as draft April 19, 2024 15:38
Copy link
Collaborator

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

Thanks for your contribution, and I apologize for the delay in reviewing this.

For easier reviewing, I suggest to split the suggested changes up in two PRs:

  • one adding the cp850 encoding - this should be straightforward.
  • one for also checking whether the path exists.

After some initial testing, it looks like the second PR would require some changes to the test suite, so I prefer getting the first change in as such, and then build on it. I'll look into this after #808 is merged.

Comment on lines 193 to +194
except UnicodeDecodeError:
click.echo("Couldn't decode the path automatically", err=True)
raise
pass
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use contextlib.suppress there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autocompletion Autocompletion functionality bug Something isn't working os / windows Related to Windows p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants