lib/sup/textfield.rb in sup-0.13.2.1 vs lib/sup/textfield.rb in sup-0.14.0

- old
+ new

@@ -166,9 +166,19 @@ if x - @question.length - v.length <= 0 v else # trailing spaces v + (" " * (x - @question.length - v.length)) end + + # ncurses returns a ASCII-8BIT (binary) string, which + # bytes presumably are of current charset encoding. we force_encoding + # so that the char representation / string is tagged will be the + # system locale and also hopefully the terminal/input encoding. an + # incorrectly configured terminal encoding (not matching the system + # encoding) will produce erronous results, but will also do that for + # a log of other programs since it is impossible to detect which is + # which and what encoding the inputted byte chars are supposed to have. + v.force_encoding($encoding).fix_encoding end def remove_extra_space return nil unless @field