CLI11 icon indicating copy to clipboard operation
CLI11 copied to clipboard

widen convert faild in Windows

Open TianZerL opened this issue 9 months ago • 3 comments

If the input filename is unicode(at least with Chinese) and use CLI::ExistingFile to check it, which will call widen_impl indirectly, the line return std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes(str, str + str_size); failed in Windows.

PS D:\temp\ac> .\ac_cli.exe '.\read - 副本.jpg'
terminate called after throwing an instance of 'std::range_error'
  what():  wstring_convert::from_bytes

I'm using Windows 11 and C++17 standard, and this happend in both VS2022 and MinGW64 gcc 14.1.0.

if I disable CLI11_HAS_CODECVT, the std::mbsrtowcs will fail too.

TianZerL avatar May 18 '24 17:05 TianZerL