DatGuy1 / Windows-Toasts

Python library used to send toast notifications on Windows machines
Apache License 2.0
96 stars 6 forks source link

Bug fix: Unable to display images when the path contains Chinese characters #111

Closed yeyt97 closed 8 months ago

yeyt97 commented 8 months ago

Using URL encoding will cause Chinese characters to display as garbled text, making it impossible to correctly display images with Chinese file paths. By using the urllib.parse.unquote() method to restore the garbled URL, the Chinese characters can be displayed properly.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (5d77515) 97.75% compared to head (45609d2) 97.75%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #111 +/- ## ======================================= Coverage 97.75% 97.75% ======================================= Files 10 10 Lines 623 624 +1 Branches 89 89 ======================================= + Hits 609 610 +1 Misses 9 9 Partials 5 5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

DatGuy1 commented 8 months ago

I don't know if this is the best way to go about this since what we're really doing here is using os.fsencode(), urllib.parse.quote_from_bytes(), and them immediately unquoting, but it passes the tests and seems to work fine. Merging.