Open AndyWatterman opened 3 years ago
C++ string handling is a bit of a mess and I'm not sure I want to try to support wstring
. Can you show me the example with UnicodeString? Because I do have a Unicode mode so I wonder if that should work.
In Windows, as far as I as I know, the only way to receive arguments using Unicode charset is by using the wmain
entrypoint, which will encode them in UTF-16 with a 2-bytes wchar_t
backend. One sane behavior would be to temporarily convert them to utf-8.
I was wanting to use this library on a Windows C++ app I'm working on and it's wchar_t top-to-bottom. I've ported this library to use wide strings throughout, it seems to be working well.
https://github.com/matttyson/cxxopts/tree/wstring3
I wasn't intending to submit this as a PR as the diff is quite horrific and I'm sure the author wouldn't want to maintain it. nevertheless you might find it useful.
I use this code:
("r, prefix", "Output file prefix", cxxopts::value<std::wstring>(prefix))
It generates error:
C2679 binary '>>': no operator found which takes a right-hand operand of type 'T' (or there is no acceptable conversion)
In this function:
I also tried using icu::UnicodeString instead of std::wstring, the same error occurs.