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

Fix Unicode decoding issue with accented characters and special symbols #44

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

B16f00t
Copy link

@B16f00t B16f00t commented Jan 25, 2025

This pull request addresses the issue with accented characters and special symbols in file paths during the drag-and-drop process.

Changes made:

  • Modified the py_drop_func to handle Unicode decoding errors.
  • Initially attempts to decode the file path using UTF-8 encoding.
  • If UTF-8 decoding fails (e.g., due to accented characters), it falls back to Windows-1252 encoding.

This fix ensures that file paths with characters like á, é, í, ó, ú, ñ, and others are handled correctly without causing errors.

This should address and close Issue #42.

Fixes issues with accented characters and special symbols by handling Unicode decoding errors.
Attempts decoding with UTF-8 first, then falls back to Windows-1252 encoding if UTF-8 fails.
@Valer100
Copy link

Valer100 commented Jan 25, 2025

For some reason it doesn't work well with some characters like ă, ș and ț. Using the same code from #42 and trying again to drag the folder named ăâîșț to the tkinter window, I'm getting this output:

['C:\\Users\\lenovo\\Desktop\\aâî??']

And normally I should get

['C:\\Users\\lenovo\\Desktop\\ăâîșț']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants