I'm trying to port a C++11 program from Windows to Linux (GCC-4.9). Originally, I just set the locale inside the program
setlocale(LC_ALL, "");
However, it was displaying missing characters on Linux (Latest version of Linux Mint). I then proceeded to save all my source files in the UTF-8 format, which fixed the problem under linux, but now all the characters are messed up in windows.
If that help, the language is french. Is there any ways to correctly display the text under both platforms without too much trouble?
I'd appreciate help, thank you.
void EcranBienvenue()
{
char coinHG = (char)201;
char coinHD = (char)187;
char coinBG = (char)200;
char coinBD = (char)188;
char ligneH = (char)205;
char ligneV = (char)186;
#ifdef _WIN32
system("cls");
#elif defined __linux__
system("clear");
#else
cout << string(20,'\n');
#endif
setlocale(LC_ALL, "C");
cout << coinHG;
for (int i = 0; i < 48; i++)
cout << ligneH;
cout << coinHD << endl;
cout << ligneV << " " << ligneV << endl;
cout << ligneV << " Les productions inc " << ligneV << endl;
cout << ligneV << " " << ligneV << endl;
cout << ligneV << " Système de gestion des abonnements " << ligneV << endl;
cout << ligneV << " " << ligneV << endl;
cout << coinBG;
for (int i = 0; i < 48; i++)
cout << ligneH;
cout << coinBD << endl;
setlocale(LC_ALL, "");
}
It's normal that the border doesn't work on Linux, yet. However, the three lines of text will be displayed accurately on the terminal.
On windows, "è" will be an incorrect character.
Système de gestion des abonnements