2

I want to draw a graphic using block characters using the Python 3.6 curses module. However, when I try to show a string like:

screen = curses.addstr(2,2,'▄ •▄       ▄▄▄▄·       ▄▄▌  ·▄▄▄▄      .▄▄▄  ▄• ')

it does not display properly and instead spits out gibberish like

▄ •▄       ▄▄▄▄·       ▄▄▌  ·▄▄▄▄      .▄▄▄  ▄• ▄▌▄▄

when I try to refresh the display.

Is there any way to properly display Unicode characters using the curses module? Using the print() command displays them just fine.

Edit: I'm not trying to have the curses module receive unicode text, I'm just trying to get it to display properly. I have written

import locale
locale.setlocale(locale.LC_ALL,"")

before my code and it still does not work.

Keinga
  • 41
  • 5
  • Assuming the underlying library is *ncursesw*, the only other thing to check for is whether Python is calling `setlocale`. By the way, the system and package names help, when asking about how to use a given feature. – Thomas Dickey Sep 10 '17 at 01:22
  • Possible duplicate of [Python curses - textpad.Textbox() keyboard input not working with German umlauts](https://stackoverflow.com/questions/42510606/python-curses-textpad-textbox-keyboard-input-not-working-with-german-umlauts) – Thomas Dickey Sep 10 '17 at 01:32
  • I put the line locale.setlocale(locale.LC_ALL,'') in my code before calling initscr and it still does not work. What do you mean by the system and package names? – Keinga Sep 10 '17 at 03:43
  • system - Arch Linux, Debian, etc. According to the system, there's likely (unless you compiled Python yourself) a package-name and version. – Thomas Dickey Sep 10 '17 at 10:23
  • I'm on Windows right now, and I'm using Python 3.6.1 / Anaconda 4.4.0 win32, – Keinga Oct 21 '17 at 06:54
  • There's **Windows** and **Cygwin**, each with its own problems and limitations. Stating that in the question is the way to start off. The mixture of characters makes it look as if you're using UTF-8 on a device which does not support that. – Thomas Dickey Oct 21 '17 at 10:49
  • Sorry, I'm a bit green when it comes to programming. I'm currently running Windows, not Cygwin, and I think my computer is able to support it - running the command print('▄ •▄ ▄▄▄▄· ▄▄▌ ·▄▄▄▄ .▄▄▄ ▄• ') displays the text in the command line perfectly. – Keinga Oct 22 '17 at 02:34

0 Answers0