Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pywinstyles/py_win_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,12 @@ def py_drop_func(hwnd, msg, wp, lp):
files = []
for i in range(count):
func_DragQueryFile(typ(wp), i, file_buffer, sizeof(file_buffer))
drop_name = file_buffer.value.decode("utf-8")
try:
drop_name = file_buffer.value.decode("utf-8")
except UnicodeDecodeError:
# If UTF-8 decoding fails, attempt to decode with a different encoding (e.g., Windows-1252)
drop_name = file_buffer.value.decode("Windows-1252")

files.append(drop_name)
func(files)
windll.shell32.DragFinish(typ(wp))
Expand Down