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

Closed
wants to merge 5 commits into 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 p2 and removed investigate labels Mar 8, 2024
@svlandeg svlandeg marked this pull request as draft April 19, 2024 15:38
Copy link
Member

@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?

@tiangolo
Copy link
Member

Thanks @matejfroebe! 🤓 This was handled in #808, so I'll close this one now. The fix will be available in the next release in a few hours. 0.13.1 🚀

@tiangolo tiangolo closed this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working os / windows Related to Windows p2 shell / powershell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants