Проще всего найти нужные символы в таблице Unicode и выводить их в кодировке utf-8.
avp@avp-ubu1:hashcode$ cat t-utf.c && gcc t-utf.c && ./a.out
#include <stdio.h>
int
main (int ac, char *av[])
{
// Коды мастей в Unicode: 0x2660 ... 0x2667
// 0010 0110 0110 0000
// 0010011001100000
// группируем биты по 6 для перевода в utf-8: 0010 011001 100000
// utf-8: 11100010 10011001 10100000 0xe2 0x99 0xa0
char *cardsuit[8] = {"\xe2\x99\xa0", // 0x2660
"\xe2\x99\xa1",
"\xe2\x99\xa2",
"\xe2\x99\xa3",
"\xe2\x99\xa4",
"\xe2\x99\xa5",
"\xe2\x99\xa6",
"\xe2\x99\xa7" // 0x2667
};
puts("https://unicode-table.com/ru/#geometric-shapes");
printf("карточные масти: ");
for (int i = 0; i < 8; i++)
printf("%s", cardsuit[i]);
return puts("") == EOF;
}
https://unicode-table.com/ru/#geometric-shapes
карточные масти: ♠♡♢♣♤♥♦♧
avp@avp-ubu1:hashcode$
Кстати, если есть какие-то проблемы с локалью (или вообще с wctomb), то для кодирования символов Unicode с помощью UTF-8 можно использовать вот такую функцию:
// returns utf-8 length (max 4) or 0 if error in ucs
// see https://unicode-table.com/en/
int
ucs_to_utf8 (unsigned int ucs, char *utf)
{
if (ucs < 128) {
utf[0] = ucs; // ascii
return 1;
}
int l;
if (ucs < (1 << 11)) { // 0x80 .. 0x7ff "Latin-1 Supplement" ... cyrillic ... NKo (africa)
// 110 xxxxx 10xxxxxx
l = 1;
utf[0] = (ucs >> 6) | 0xc0;
} else if (ucs < (1 << 16)) { // 0x800 ... 0xffff Samaritan ... CJK ... Specials
// 1110 xxxx 10xxxxxx 10xxxxxx
l = 2;
utf[0] = (ucs >> 12) | 0xe0;
utf[1] = ((ucs >> 6) & 0x3f) | 0x80;
} else if (ucs > 0xe01ef) // not defined yet
return 0;
else { // 0x10000 ... 0xe01ef "Linear B Syllabary" ... "CJK Compatibility Ideographs Supplement" ...
// 11110 0xx 10xxxxxx 10xxxxxx 10xxxxxx
l = 3;
utf[0] = (ucs >> 18) | 0xf0;
utf[1] = ((ucs >> 12) & 0x3f) | 0x80;
utf[2] = ((ucs >> 6) & 0x3f) | 0x80;
}
utf[l] = (ucs & 0x3f) | 0x80; // low 6 bits
return ++l;
}
0x2593
- невалидное значение для паттерна%c
, вам стоит попробовать печатать байты представляющие собой текст в кодировке utf-8. Ну или переключить эмулятор терминала на использование символов в той кодировке, которую вы использовали на Windows