PDA

View Full Version : The device name from QAudioDeviceInfo show wrong



wang9658
9th August 2012, 16:14
I'm trying to enumerate the audio device in the system with QAudioDeviceInfo, this is the codes:


foreach(const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioIn put)){
QString name = deviceInfo.deviceName();
qDebug() << "Device name: " << name;
}

If the system is windows, and the character code is GBK, the deviceName is very strange. I dumped the hex datas from deviceName.
8117

I looked into GBK code page: http://www.khngai.com/chinese/charmap/tblgbk.php?page=4
The soudcard info is chinese language, and GBK coding. But each byte followed by one 00, even the ascii parts.

My question is how to convert the byte array to real unicode QString with QT method? If this is a bug for QT?