Skip to content

Commit e33bd89

Browse files
committed
Use MBCS encoding for MME, too
1 parent 76fe59d commit e33bd89

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sounddevice.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,10 @@ def query_devices(device=None, kind=None):
620620
if not info:
621621
raise PortAudioError("Error querying device {0}".format(device))
622622
assert info.structVersion == 2
623-
if info.hostApi == _lib.Pa_HostApiTypeIdToHostApiIndex(_lib.paDirectSound):
624-
encoding = 'mbcs'
625-
else:
626-
encoding = 'utf-8'
627623
device_dict = {
628-
'name': _ffi.string(info.name).decode(encoding, 'replace'),
624+
'name': _ffi.string(info.name).decode('mbcs' if info.hostApi in (
625+
_lib.Pa_HostApiTypeIdToHostApiIndex(_lib.paDirectSound),
626+
_lib.Pa_HostApiTypeIdToHostApiIndex(_lib.paMME)) else 'utf-8'),
629627
'hostapi': info.hostApi,
630628
'max_input_channels': info.maxInputChannels,
631629
'max_output_channels': info.maxOutputChannels,

0 commit comments

Comments
 (0)