I have a sample piece of C++ code that is throwing an exception on Linux:
namespace fs = std::filesystem;
const fs::path pathDir(L"/var/media");
const fs::path pathMedia = pathDir / L"COMPACTO - Diogo Poças.mxf" // <-- Exception thrown here
The exception being thrown is: filesystem error: Cannot convert character sequence: Invalid in or incomplete multibyte or wide character
I surmise that the issue is related to the use of the ç
character.
- Why is this wide string (wchar_t) an "invalid or incomplete multibyte or wide character"?
- Going forward, how do I make related code cross-platform to run on Windows and/or Linux.
- Are there helper functions I need to use?
- What rules do I need to enforce from a programmer's PoV?
- I've seen a response here that says "Don't use wide strings on Linux", do I use the same rules for Windows?
Linux Environment (not forgetting the fact that I'd like to run cross-platform):
- Ubuntu 18.04.3
- gcc 9.2.1
- C++17