[Gambas-user] ncurses help texts missing

Rolf-Werner Eilert eilert-sprachen at ...221...
Mon Mar 31 15:41:33 CEST 2014



Am 31.03.2014 15:26, schrieb Tobias Boege:
> 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.

Ok, I see your point. I was talking 8-bit ASCII here like I was used to 
have in old DOS programming times. In the upper half of this encoding, 
there are umlauts and some accent letters.

>
> What do you mean by "conversion table"? Do you want to have a-umlaut to be
> "ae" or "a" or "?" or ...?

"ae" would be a good workaround, but it would mean two letters instead 
of one, so it might destroy the programmer's "line" order in a text screen.

I found this page

http://www.melvilletheatre.com/articles/ncurses-extended-characters/index.html

and it says "228" for an "ä", but I tried to encode by writing a little 
function

Private Function charConv(srcString As String) As String

   Replace$(srcString, "ä", Chr$(228))

   Return srcString

End

and the result was "M-CM-$" for it... What a shame :-)



> 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.

Midnight-Commander (also made with ncurses) can display German umlauts 
in file names. Maybe you could ask the guys who made it how they did the 
trick... And consoles know umlauts, too. Maybe a simple Esc-code that 
produces the special characters in a console would do?

>
> 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". ]

I'd prefer "ss", but it's the thing with the two-letter problem again...

>
> 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.

Yep.

>
> 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... ]

Wow... Never done such a thing before. Sounds easy though as long as you 
know what to do... :-)


Regards

Rolf




More information about the User mailing list