I'm developing a little game intended to be run into a console. For this reason I have to be sure about which characters can I print into the console.
1) Can I assume chars 0..127 are the same everywhere? I fear not.. at least some difference between Linux and Windows
perl -e "print chr($_) for 0..127" # cmd.exe 123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde +fghijklmnopqrstuvwxyz{|}~ perl -e 'print chr($_) for 0..127' # linux 123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv +wxyz{|}~ # update: I forgot the tilde in the linux output thanks choroba who sp +otted it
On some windows version first chars ( control ones 0..31 ) are displayed as funny elements: smiling faces, palying card seeds.. I suppose this is not portable at all.
2) What about extended ASCII?
I see a lot fancy charcaters printed in cmd.exe and only garbage in Linux console. Here the differences are bigger.. I suspect I cannot trust these chars to be the same everywhere.perl -e "print chr($_) for 128..255" # cmd.exe perl -e 'print chr($_) for 128..255' # linux
3) cmd.exe has the codepage notion (see chcp where is stated the very limited support for unicode). Linux has the locale with the character set is specified.
4) So which characters I can expect to be printed equal on different platform? Only 32..127 ? what about 128..255 ones?
5) M for mountains and m for hills are a bit ugly to see, so I played a bit with bitfontmaker2 website and it permit the easy creation of a custom font. It offers to modify/create 316 (?!) different chars... how can these are mapped with our perl 0..255 ones? I know that cmd.exe only has a, even limeted, support for monospaced ttf fonts: I have tried a custom Lucida Console font with success ( horrible atm available here ). Are these fonts copyrighted? In case I can create a custom, usable font, how can I map to these custom chars? via chr(xx) ?
Thanks for any clarification you will be able to provide.
L*
In reply to [OT] ASCII, cmd.exe, linux console, charset, code pages, fonts and other amenities by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |