ruby / curses

Ruby binding for curses, ncurses, and PDCurses. Formerly part of the ruby standard library.
Other
296 stars 34 forks source link

Encoding issues #65

Open apexatoll opened 3 years ago

apexatoll commented 3 years ago

I'm, currently experiencing an issue with the "inch" method in Ruby curses, this is reproducible in both curses 1.4.2 and 1.4.1. However the issue is not present in curses 1.4.0

Using win.inch.chr returns the character at the cursor position as intended, but in curses 1.4.1/2 this results in an error saying char is out of range. Manually setting the encoding to UTF_8 or UTF_16 removes the error message but does not return the character as intended

ie Curses 1.4.0 win.inch.chr expected behaviour Curses 1.4.1+ win.inch.chr error, char out of range Curses 1.4.1+ win.inch.chr(Encoding::UTF_8) returns ? block Curses 1.4.1+ win.inch.chr(Encoding::UTF_16) interferes with formatting

shugo commented 2 years ago

@apexatoll

The return value inch may be OR'ed with attribute flags.

Does (win.inch & Curses::A_CHARTEXT).chr work? If it doesn't work, please show me your code.