qjackctl icon indicating copy to clipboard operation
qjackctl copied to clipboard

Character issues on portaudio device list (utf-8 related?)

Open falkTX opened this issue 3 years ago • 13 comments

When listing devices via portaudio, if any of them contain non-ascii characters, there seems to be issues. Did not reproduce this myself, was reported to me by somebody else.

See the image below: image

Ideas on the cause of this and possible fixes?

falkTX avatar Oct 12 '20 10:10 falkTX

this part of code is probably @kmatheussen to blame :) maybe some QString::fromLocal8Bit(); fromUtf8() may fixit somewhere. cheers

rncbc avatar Oct 12 '20 13:10 rncbc

https://github.com/rncbc/qjackctl/blob/master/src/qjackctlInterfaceComboBox.cpp#L225 seems to be the place to change. what is the best way to convert to qstring here? not too familiar with const-char to qstring conversions, in pyqt everything is a regular python string.

falkTX avatar Oct 12 '20 14:10 falkTX

whole issue seems to go around correct source string encoding: my 1st. guess would be to replace QString(pDeviceInfo->name) with QString::fromUtf8(pDeviceInfo->name) good luck ;) cheers

rncbc avatar Oct 12 '20 14:10 rncbc

I think this code is written by @sletz. :-) Anyway, googling the problem it seems like portaudio uses utf-8, so perhaps QString::fromUtf8 will work. I also found this code:

wchar_t wideName[MAX_PATH];
MultiByteToWideChar(CP_UTF8, 0, deviceInfo->name, -1, wideName, MAX_PATH-1);

at line 168 here: http://portaudio.com/docs/v19-doxydocs/pa__devs_8c_source.html

kmatheussen avatar Oct 12 '20 14:10 kmatheussen

...so if QString::fromUtf8 doesn't work, something like this

wchar_t wideName[MAX_PATH];
MultiByteToWideChar(CP_UTF8, 0, deviceInfo->name, -1, wideName, MAX_PATH-1);
const QString sName = QString::fromWCharArray(wideName);

might.

kmatheussen avatar Oct 12 '20 14:10 kmatheussen

@ReinholdH please try the installer from https://github.com/jackaudio/jack2-releases/releases/tag/untagged-6be5f7fb64c472ce364f and let us know if that fixes the issue for you.

falkTX avatar Oct 12 '20 18:10 falkTX

The character set issue which is reported here still exists in this new build.

ReinholdH avatar Oct 13 '20 08:10 ReinholdH

@ReinholdH please try https://github.com/jackaudio/jack2-releases/releases/tag/untagged-eb79ebd3d89359110044 This has the alternative approach as suggested by portaudio code. Thanks again!

falkTX avatar Oct 14 '20 20:10 falkTX

Thx. But I do not see any difference. All issue are still there.

ReinholdH avatar Oct 15 '20 11:10 ReinholdH

That's a bummer. So the issue might be in my Qt5 build perhaps. We will have to do the 1.9.15 jack2 release without a fix for this

falkTX avatar Oct 15 '20 11:10 falkTX

Isn't it more likely that the name is not utf-8 in the portaudio driver than there is a problem your Qt5 build? I've basically given up trying to use char* in windows, I just use wchar_t everywhere.

On Thu, Oct 15, 2020 at 1:52 PM Filipe Coelho [email protected] wrote:

That's a bummer. So the issue might be in my Qt5 build perhaps. We will have to do the 1.9.15 jack2 release without a fix for this

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rncbc/qjackctl/issues/104#issuecomment-709236721, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIX3J2XTZWWVOULLNE7DZDSK3O6NANCNFSM4SMUEG4A .

kmatheussen avatar Oct 15 '20 12:10 kmatheussen

Dont know yet. Will be best for me to try to find a way to reproduce first.

The Qt5 build I am using does not have ICU support, but for UTF-8 that should not be an issue I think.. Maybe @ReinholdH system is using some other encoding..?

falkTX avatar Oct 15 '20 12:10 falkTX

I believe the charset is Windows-1252. See https://en.wikipedia.org/wiki/Windows-1252 This is the regular Windows charset for Western Euqope. But the issue is definitely not important.

ReinholdH avatar Oct 15 '20 14:10 ReinholdH