BR: String::toUpperCase is wrong

With the latest Apple Clang/Xcode – test code:

const String source (CharPointer_UTF8 ("\xc3\x8b, \xc3\xab"));  // "Ë, ë"
const auto upperCase = source.toUpperCase();
jassert (upperCase == CharPointer_UTF8 ("\xc3\x8b, \xc3\x8b")); // Expected: "Ë, Ë"
jassert (upperCase.getCharPointer().isUpperCase());             // Expected "true"

Presumably this has to do with CharacterFunctions::toUpperCase and subsequently towupper… but couldn’t say how or why.

Edit: it seems that towupper isn’t really going to do anything expected as it’s predicated around the C++ locale stuff and is implemented defined/has no standard – which is generally pretty bogus.

Strangely, towupper works for me on Godbolt with GCC and Clang, and doesn’t with MSVC. Fun stuff. Some test code:

#include <iostream>
#include <cwctype>
#include <clocale>
int main()
    wchar_t c = L'\u00eb';
    std::cout << std::hex << std::showbase;
    std::cout << "in the default locale, towupper(" << (std::wint_t)c << ") = "
              << std::towupper(c) << '\n';
    std::setlocale(LC_ALL, "en_US.utf8");
    std::cout << "in Unicode locale, towupper(" << (std::wint_t)c << ") = "
              << std::towupper(c) << '\n';