ANSI code page character error in ASIOAudioIODevice::getLastDriverError



Here an enhancement proposal
On Windows 10, asioObject->getErrorMessage can return bad local ANSI code page character
So in Juce 5.4.1 juce_win32_ASIO.cpp, @line 1118 ASIOAudioIODevice::getLastDriverError
istead of converting char buffer[512] into String, I propose the following snippet:

String getLastDriverError() const
    jassert (asioObject != nullptr);
    char buffer[512] = {};
    asioObject->getErrorMessage (buffer);
    return convertASIOString(buffer, numElementsInArray(buffer) - 1); // use enhanced converter

I also extand converter function buffer accordingly:

static String convertASIOString (char* text, int length)
    if (CharPointer_UTF8::isValidString (text, length))
        return String::fromUTF8 (text, length);

    WCHAR wideVersion[512] = {}; // grow to 512 for error instead of 64
    MultiByteToWideChar (CP_ACP, 0, text, length, wideVersion, numElementsInArray (wideVersion));
    return wideVersion;

Hopping all of this can be merged in master branch.

Best regards


Thanks, I’ve added this to the develop branch here.


Many thanks for your concern about this and your reactivity.
Best regards,