Does this program mean four card suits (♠ ♣ ♥ ♦) on all standard systems?

Below is shown ♠ ♣ ♥ ♦ on xp windows, will it be for all systems?

#include <stdio.h>
int main(int argc, char *argv[])
{
    for (int i = 3; i <= 6; ++i)
        printf("%c", (char)i);

    getchar();
    return 0;
}
+4
source share
4 answers

Nope. In my experience, character encoding is very platform dependent.

Consider that in ASCII these characters do not even exist . And I don’t know where they are in Unicode. And wherever they are, then you will depend on how your platform displays Unicode.

+13
source

, ASCII. CP437, IBM PC. , ASCII, ASCII , , . , ; Windows, ; Windows, CP1252.

, Unicode, , 0x2660-0x2667. . , Unicode ( !) Unicode.

, , Unicode, Unix Windows, , Unicode ( , , ), , , .

+12

UTF-8 :

  • ♠ = 0x2660 = 0xE2 0x99 0xA0
  • ♥ = 0x2665 = 0xE2 0x99 0xA5
  • ♦ = 0x2666 = 0xE2 0x99 0xA6
  • ♣ = 0x2663 = 0xE2 0x99 0xA3
  • ♤ = 0x2664 = 0xE2 0x99 0xA4
  • ♡ = 0x2661 = 0xE2 0x99 0xA1
  • ♢ = 0x2662 = 0xE2 0x99 0xA2
  • ♧ = 0x2667 = 0xE2 0x99 0xA7

Mac OS X FTW.

, . 0x2660..0x2663 , , (♠ ♡ ♢ ♣), 0x2660..0x2663 - , (♤ ♥ ♦ ♧).

P.S. , , - ", ?"

+7

( , ), (, "\n" ), .

- Unicode ( , .

+3

All Articles