std::transform(str.begin(),str.end(),back_inserter(ext),[](char t) -> wchar_t { return t == ';' ? 0 : t; });
I don't think that's actually going to do the right thing if there's anything other than US ASCII in the original string. A simple integral promotion from a multibyte UTF-8 string into Microsoft's proprietary UCS-2 wide-character Unicode variant is a fail.
Of course, if you're restricting your somain to US ASCII, you're fine.
Microsoft hasn't used UCS-2 since Windows 2000. All modern versions of Windows use UTF-16 which is a multibyte encoding the same as UTF-8. Converting a UTF-8 string to UTF-16 is not going to make it easier to process.