0

(Also read edit)

I'm working on an assignment that has to do with a game. My lecturer specifically said that only modules from the standard library are allowed, which means that third-party modules are not allowed.

I want to be able to print any unicode characters I want from the list of all possible unicode characters there are out there. Printing this:

    print(" ⚫ ") #Medium Black Circle
    print("  ") #some smiling cat i found on the internet
    print("  ") # and a slice of pizza

it just outputs this on the Windows command prompt:

    ?
    ??
    ??

How do I accomplish this? :(

Edit:

As stated by user @Mofi , the Windows command prompt is a

non-graphic user interface

Therefore, emojis can't really be displayed in cmd.

Just to further clarify, I'm okay if the emojis can't be displayed on cmd but what about the "Medium Black Circle" which kinda looks like a text similar to "█" or "╝" and the likes.

And, if possible, where can I get a list of all characters similar to "█", "░" and "╝"?

AxeSkull
  • 33
  • 6
  • 1
    https://superuser.com/questions/1197986/how-do-i-deal-with-emoji-in-command-prompt#comment1741722_1197987 – snakecharmerb Apr 28 '19 at 16:18
  • 1
    Do you really want to use __graphic__ symbols in a __non-graphic__ user interface like a Windows command prompt window? I doubt that any font supporting those emojis is designed for output them in pure text environment even on using `chcp 65001` to change [character encoding](https://en.wikipedia.org/wiki/Character_encoding) to multi-byte [UTF-8](https://en.wikipedia.org/wiki/UTF-8) encoding from one byte per character *OEM* encoding as used by default according to configured country for used account and shown on running just `chcp`. – Mofi Apr 28 '19 at 17:09
  • What you want to print aren't Unicode glyphs (although some may have similar-looking Unicode counterparts). – martineau Apr 28 '19 at 17:51
  • @martineau They _are_ unicode glyphs: `ord("⚫")` -> 9899; `ord("")` -> 128568; `ord("")` -> 127829. – DYZ Apr 28 '19 at 20:48
  • [Possible dupe](https://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console). – DYZ Apr 28 '19 at 20:51
  • Set console to UTF-8 (`chcp 65001`) then change the font in properties to a Unicode font. – Noodles Apr 28 '19 at 22:01
  • `C:\WINDOWS\system32>chcp 65001` `Active code page: 65001` `C:\WINDOWS\system32>echo ●` `●` This is Consolas font which has more symbols than Lucinda Console. See Character Map for what symbols a font has. – Noodles Apr 28 '19 at 23:00
  • Run in your cmd window `chcp` and see which code page is output. Look on Wikipedia which characters this code page contains with which code values. Then write the batch file accordingly. For example in Western European countries code page [Windows-1252](https://en.wikipedia.org/wiki/Windows-1252) is used in Windows GUI applications on non-Unicode editing while in command prompt window code page [OEM 850](https://en.wikipedia.org/wiki/Code_page_850) is used by Windows by default. – Mofi Apr 29 '19 at 05:18
  • For example the byte with hexadecimal value `CB` is interpreted with `Windows-1252` as character `Ë`, but with `OEM 850` as character `╦`. So with ANSI (Windows-1252) encoding enabled in GUI text editor it is necessary to enter `Ë` in the batch file to get this character output as `╦` on execution of the batch file. Some text editors like UltraEdit support ANSI to OEM and OEM to ANSI conversions. – Mofi Apr 29 '19 at 05:23
  • Thanks, guys. I'll try some of the suggestions listed here. – AxeSkull Apr 29 '19 at 08:26

1 Answers1

0

Those characters you are referencing at the end are called box-drawing characters and you can find out all about them here.

You can print them in Python by doing, for example, print("\u2585") which will display as ▅ even on a command prompt. This works for all box-drawing characters.

isaactfa
  • 5,461
  • 1
  • 10
  • 24