Skip to content

Commit

Permalink
Fix chinese characters on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmikler committed Dec 28, 2024
1 parent 7ba1b66 commit 1b76652
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions playsound3/playsound3.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ def _send_winmm_mci_command(command: str) -> Any:
if sys.platform != "win32":
raise RuntimeError("WinMM is only available on Windows systems.")
winmm = ctypes.WinDLL("winmm.dll")
buffer = ctypes.create_string_buffer(255)
error_code = winmm.mciSendStringA(ctypes.c_char_p(command.encode()), buffer, 254, 0)
buffer = ctypes.create_unicode_buffer(255) # Unicode buffer for wide characters
error_code = winmm.mciSendStringW(ctypes.c_wchar_p(command), buffer, 254, 0) # Use mciSendStringW
if error_code:
logger.error("MCI error code: %s", error_code)
return buffer.value
Expand Down

0 comments on commit 1b76652

Please sign in to comment.