Reputation: 61
I'm trying to use Unicode box drawing characters in a C program that is intended to be portable across a range of operating systems, C compilers and environments. Example:
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
printf ("┌─────┐\n");
printf ("│┼┼┼┼┼│\n");
printf ("└─────┘\n");
return EXIT_SUCCESS;
}
The above works just fine in Linux with either gcc or icc, in Windows WSL with gcc, in Windows with Cygwin gcc in both Command Prompt and Cygwin Terminal windows, and with Windows MinGW in a Command Prompt window. That is, in all those cases, the output looks like this:
┌─────┐
│┼┼┼┼┼│
└─────┘
But with MinGW in a Cygwin Terminal, the output looks like this:
ÔöîÔöÇÔöÇÔöÇÔöÇÔöÇÔöÉ
ÔöéÔö╝Ôö╝Ôö╝Ôö╝Ôö╝Ôöé
ÔööÔöÇÔöÇÔöÇÔöÇÔöÇÔöÿ
The problem doesn't seem to be the Cygwin Terminal font, because the same program compiled with Cygwin gcc displays correctly in the same Cygwin Terminal. Also, the same MinGW program displays correctly in a Windows Command Prompt window, just not in a Cygwin Terminal.
Windows compiler versions used:
gcc (MinGW.org GCC-6.3.0-1) 6.3.0
gcc (GCC) 11.3.0 - with Cygwin
What do I need to do to fix this please?
Thanks, Peter McGavin.
Upvotes: 0
Views: 293