Open mcmarius opened 4 years ago
@mcmarius
The second issue encountered was the from_bytes conversion in function std::wstring utf8_decode(const std::string &str) from indicators/display_width.hpp
Can you describe the issue that was encountered?
It seems that std::wstring_convert::from_bytes
does not like 4-byte characters on Windows with gcc and throws an exception:
terminate called after throwing an instance of 'std::range_error'
what(): wstring_convert::from_bytes
It is called in the return statement of utf8_decode
in indicators/display_width.hpp:285
. It works fine on WSL now, but still throws an exception when compiling the demo with gcc MinGW. It works with 3-byte emojis such as ⌚️.
Replacing utf8_decode
with the function in the linked SO answer seems to solve the issue.
With Terminus it works as expected, but there is another issue with 3-byte emojis using windows terminal which reproduces both on powershell profile and on wsl. This might be the fault of Windows Terminal though:
All emojis up to U+329x seem to exibit this behaviour (extra newlines), while emojis from U+1F00x seem to break on Windows without the mentioned fix (I picked some emojis randomly from this wikipedia article).
Hey, first of all, awesome work! 😃
I ran into some issues when building and running the demo and I would like to share my workarounds.
First error (among many others caused by the missing header)
In
indicators/termcolor.hpp
, some Windows-specific headers are not included. I changed lines 36-44 (moved anendif
) to this:The second issue encountered was the
from_bytes
conversion in functionstd::wstring utf8_decode(const std::string &str)
fromindicators/display_width.hpp
. I replaced it with the function from this answer. Though I'm not sure if this second workaround is portable.Second issue appears when using an emoji as lead in the nested progress bar example
Also posting it here if the stackoverflow answer gets deleted
An
#include <vector>
would also be necessary for the above workaround.My current environment is the following:
indicators
latest commit (af7c004832cb23de824fe4acf78bfa0dd9fe0758 as of 11 november 2020)