Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WideChar on GNOME Terminal #5

Closed
SanJ2312 opened this issue Sep 10, 2019 · 4 comments
Closed

WideChar on GNOME Terminal #5

SanJ2312 opened this issue Sep 10, 2019 · 4 comments

Comments

@SanJ2312
Copy link

I faced a issue with text output where all text was being displayed in chinese. I could fix the problem locally by changing wstring converter to <std::codecvt_utf8<wchar_t>> in string.cpp . May i know if this is the correct way ? Thanks.

@ArthurSonzogni
Copy link
Owner

HI,
Thanks for reporting this issue !
Could you please show how to reproduce your problem? What do you get?

I expect the gnome terminal to send UT8 encoded characters. Then inside ftxui, everything is utf16. That's why there are conversion when entering and leaving ftxui.

@SanJ2312
Copy link
Author

SanJ2312 commented Sep 10, 2019

#include
#include
#include
#include
using namespace std;

wstring to_wstring1(const string& s)
{
wstring_convert<codecvt_utf8_utf16<wchar_t>> converter;
return converter.from_bytes (s);
}

wstring to_wstring2(const string& s)
{
wstring_convert<codecvt_utf8<wchar_t>> converter;
return converter.from_bytes (s);
}

int main()
{
string myString = "String";
wstring wideconversion1 = to_wstring1 (myString);
wstring wideconversion2 = to_wstring2 (myString);
wcout << wideconversion1 << " " << wideconversion2 << std::endl;
return 0;
}

This code will help in reproducing the issue on GNOME Terminal.

@ArthurSonzogni
Copy link
Owner

Sorry I would like to help, but I don't understand. Could you please describe your issue?

@SanJ2312
Copy link
Author

The problem is with using older version of gcc . I was using gcc 6.3. Which might not have implemented the codecvt correctly.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants