I'd use C++ tools:
#include <iostream>
#include <string>
// construct a wstring from a string
std::wstring to_wstring(std::string const& str)
{
const size_t len = ::mbstowcs(nullptr, &str[0], 0);
if (len == size_t(-1)) {
throw std::runtime_error("to_wstring()");
}
std::wstring result(len, 0);
::mbstowcs(&result[0], &str[0], result.size());
return result;
}
//
// TEST CASES ---
//
const wchar_t key[] = L"764frtfg88fgt320nolmo098vfr";
const auto wkey = std::wstring(key);
bool operator==(std::string const& lhs, std::wstring const& rhs)
{
return to_wstring(lhs) == rhs;
}
bool operator==(std::wstring const& lhs, std::string const& rhs) { return rhs == lhs; }
int main() {
std::cout << std::boolalpha << ("hello" == wkey) << "\n"
<< (wkey == "764frtfg88fgt320nolmo098vfr") << "\n";
}
Prints
false
true
Its perks are that it (should) work(s) with non-ASCII characters on both *nix and windows.