[Gambas-user] ncurses help texts missing

Tobias Boege taboege at ...626...
Mon Mar 31 15:26:08 CEST 2014


On Mon, 31 Mar 2014, Rolf-Werner Eilert wrote:
> [I'll free that thread from some lines...]
> 
> >> Moreover, umlauts aren't printed correctly (I guess it's UTF-8). Is
> >> there a solution?
> >>
> >
> > My turn. NCurses offers an ncursesw library for wide characters - I just
> > don't use it.
> >
> > Not out of ignorance or laziness but because I want to use the CDK (curses
> > development kit) to implement controls in the terminal (Button (yes, with
> > mouse support!), TextBox, TextArea, ListBox, Menu, etc.). And the CDK does
> > not support wide characters (which UTF-8 ones are). If I rewrite gb.ncurses
> > to use ncursesw now, I'll certainly run into compatibility problems with the
> > CDK later.
> >
> > MAYBE, I can dig into the CDK in summer and try to patch it to use ncursesw.
> > However, Thomas Dickey says that this is not as trivial as one might think
> > at first. If this does not work, I'm afraid gb.ncurses will not support wide
> > characters.
> >
> 
> Rather ambitious :-)
> 
> But couldn't I use Conv() to achieve that? I tried
> 
> hDialog.Caption = (Conv$("Make a choice ???", "UTF-8", "ASCII"))
> 
> but it gave a conversion error. So I tried
> 
> hDialog.Caption = (Conv$("Make a choice", "UTF-8", "ISO-8859-15"))
> 
> and it gave no error (but the result was wrong, of course).
> 
> So, what character set does ncurses use then? Can I use conv() for it 
> anyway? If not, there should be a way to write a simple conversion table 
> for German umlauts, e. g. using Replace().
> 

NCurses is ASCII-based. You cannot encode umlauts into ASCII, so the
conversion attempt will fail.

What do you mean by "conversion table"? Do you want to have a-umlaut to be
"ae" or "a" or "?" or ...? My mail client, mutt, uses the question mark to
replace any non-ASCII character (as can be seen above) and this seems to be
a pretty good solution as there are also letters with diacritics in some
languages and those have no representation like "ae" for a German a-umlaut.

Like how would you distinguish between "e accent aigu" and "e accent grave"
from French if you only have ASCII letters? If you want to print "e" in both
cases, this is a decision of personal taste or some convention. [ Likewise,
what about Eszett in German? I like to write "sz" but others like "ss". ]

Therefore, I don't think that this conversion table will go into gb.ncurses
directly because as soon as gb.ncurses messes with strings from users, I
will get tons of mails flagged as "bug report" saying that their strings are
"corrupted" by gb.ncurses.

What you can do is the following: create and export your own Window class
and hook the Print method. Do your conversion there and then call
Super.Print(). This way, the conversion is specific to your application but
you can use gb.ncurses like you always did. [ You may even want to write a
gb.ncurses.umlauts component/library... ]

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list