Ruby curses: “Real” borders?

Hi there,

I’m just trying to get started with the curses library in Ruby’s
standard library. I wanted to draw a window using the “real” unicode
characters for this, i.e. ─ for horizontal and │ for vertical lines
(UTF-8 being pretty standard now, using - and | is not an option). So I
tried the obvious (the following is a self-contained example):

──────────────────────────────────────

-- coding: utf-8 --

require “curses”

include Curses

begin
crmode

str = “Hello world :slight_smile:

win = Window.new(lines, cols, 0, 0)
win.box(“─”, “│”)
#win.box("-", “|”)
win.setpos( lines / 2, (cols / 2) - (str.chars.count / 2) )
win.addstr str

win.refresh
win.getch
ensure
close_screen
end
──────────────────────────────────────

This presents me a window with a border of blinking reverse-video “â”
characters instead of the expected continuous lines. Interestingly, the
unicode smiley (:slight_smile:) in #addstr is displayed correctly, so I doubt it’s a
problem with curses itself.

So: How do I get continuous lines for window borders with curses?

Valete,
Marvin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs