From: robiwan Date: Wed, 22 Feb 2012 12:44:10 +0000 (+0000) Subject: Added support for displaying UTF-8 encoded device names X-Git-Tag: pa_stable_v19_20140130_r1919~82 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=f5bb9cfec0ca90afe900694bbc2c5a7cd6ab0c38;p=portaudio Added support for displaying UTF-8 encoded device names --- diff --git a/examples/pa_devs.c b/examples/pa_devs.c index e630900..3162310 100644 --- a/examples/pa_devs.c +++ b/examples/pa_devs.c @@ -49,6 +49,8 @@ #include "portaudio.h" #ifdef WIN32 +#include + #if PA_USE_ASIO #include "pa_asio.h" #endif @@ -157,7 +159,15 @@ int main(void) printf( " ]\n" ); /* print device info fields */ +#ifdef WIN32 + { /* Use wide char on windows, so we can show UTF-8 encoded device names */ + wchar_t wideName[MAX_PATH]; + MultiByteToWideChar(CP_UTF8, 0, deviceInfo->name, -1, wideName, MAX_PATH-1); + wprintf( L"Name = %s\n", wideName ); + } +#else printf( "Name = %s\n", deviceInfo->name ); +#endif printf( "Host API = %s\n", Pa_GetHostApiInfo( deviceInfo->hostApi )->name ); printf( "Max inputs = %d", deviceInfo->maxInputChannels ); printf( ", Max outputs = %d\n", deviceInfo->maxOutputChannels );