Trying to use escape sequences to construct a char8_t
string (to not rely on file/compiler encoding), I got issue with MSVC.
I wonder if it is a bug, or if it is implemention dependent.
Is there a workaround?
constexpr char8_t s1[] = u8"\xe3\x82\xb3 \xe3\x83\xb3 \xe3\x83\x8b \xe3\x83\x81 \xe3\x83\x8f";
constexpr unsigned char s2[] = "\xe3\x82\xb3 \xe3\x83\xb3 \xe3\x83\x8b \xe3\x83\x81 \xe3\x83\x8f";
//constexpr char8_t s3[] = u8"コ ン ニ チ ハ";
static_assert(std::equal(std::begin(s1), std::end(s1),
std::begin(s2), std::end(s2))); // Fail on msvc
Note:
Final goal is to replace std::filesystem::u8path(s2)
(std::filesystem::u8path is deprecated since C++20) by std::filesystem::path(s1)
;