bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ncurses garbled characters redux


From: Rich Burridge
Subject: ncurses garbled characters redux
Date: Tue, 29 Aug 2017 13:36:48 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hi all,

We have a weird one. This is on Solaris with ncurses version 6.0-20170708
(with --with-abi-version=5 ;-) ), and Python 2.7.13.

We are seeing "garbage characters" when running the Solaris text installer
on a physical console (either directly on bare metal or with something
like the VirtualBox console). See the attached image.

We've isolated the problem into the following small example:

$ cat example.py
#!/usr/bin/python

import curses
import locale

locale.setlocale(locale.LC_ALL, "")
initscr = curses.initscr()
curses.start_color()
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
default = curses.color_pair(1) | curses.A_BOLD
curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_CYAN)
list_field = curses.color_pair(5) | curses.A_BOLD
initscr.clear()

window = curses.newwin(10, 15, 0, 2)
window.bkgd(ord(' '), default)
window.addstr(0, 0, "Hello World")
window.hline(1, 3, curses.ACS_HLINE, 5)
window.bkgd(ord(' '), list_field)
window.noutrefresh()
curses.doupdate()
while True:
    pass

If this is run with:

  $ LANG=en_US.UTF-8 python example.py

on the physical console we again see the "garbage characters"
in place of the horizontal line.

If we run it with:

  $ LANG=C python example.py

we do not see a problem (a horizontal line is nicely drawn).

Also if we run the example on a serial line, or in a pseudo tty in a terminal
window (either with "LANG=en_US.UTF-8" or "LANG=C") everything looks good.


I googled a bit to try to see if this was already know, and found:

https://stackoverflow.com/questions/42792280/linux-terminal-print-weird-characters-when-using-curses-library

and:

https://stackoverflow.com/questions/12089306/strange-extended-characters-in-ncurses

but I'm not sure if that's the exact same thing though.


I went and looked at the _curses* ones for our Python 2.7 and found:

$ ldd /usr/lib/python2.7/lib-dynload/_curses.so
        libncursesw.so.5 =>      /usr/lib/libncursesw.so.5
        libpython2.7.so.1.0 =>   /usr/lib/libpython2.7.so.1.0
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1

$ ldd /usr/lib/python2.7/lib-dynload/_curses_panel.so
        libpanelw.so.5 =>        /usr/lib/libpanelw.so.5
        libpython2.7.so.1.0 =>   /usr/lib/libpython2.7.so.1.0
        libncursesw.so.5 =>      /usr/lib/libncursesw.so.5
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1

so I don't think it's the libncurses vs libncursesw issue mentioned.

Any suggestions on what might be causing this?

Thanks.


Attachment: garbled_characters.jpg
Description: JPEG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]