Jens Schmidt on Fri, 21 Apr 2017 16:50:52 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: PARI/GP for Windows doesn't support umlauts and diacritical signs but it's possible


Bill Allombert schrieb:
> On Fri, Apr 21, 2017 at 11:39:00AM +0200, Jens Schmidt wrote:
>> There is another related? effect with readline and colors in Windows
>> (not only in Wine).
>>
>> To test this start clean PARI/GP without any preloaded defaults in a
>> windows console:
>>
>>   gp -f
>>   default(prompt, "gp >")
>>   default(colors, brightfg)
>>   default(readline, 0)
>>
>> The white prompt switches to yellow color and brightness on. Now type:
>>
>>   default(readline, 4)
>>
>> The prompt switches back to white color and brightness off. This
>> should'nt happen.
> 
> This is a know issue. The default Windows terminal does not handle
> ANSI color sequences, so we use a function win32_ansi_fputs()
> in src/systems/mingw/mingw.c that parses the color code and sets the
> terminal color using SetConsoleTextAttribute.
> 
> Unfortunately the prompt is printed directly by readline and we did
> not find a way to have readline use win32_ansi_fputs() or set the
> color correctly.
> 
> If you have a solution for this, please tell us.
> 
> Cheers,
> Bill.
> 

Readline isn't set to "eightbit" mode. This mode doesn't solve the color
bug - but it solves the problem with special chars.

I initialized eightbit mode manually in gp_rl.c: init_readline() and
special chars are working with readline for Windows, even the Linux
compose key in Wine:

      _rl_meta_flag = 1;
      _rl_convert_meta_chars_to_ascii = 0;
      _rl_output_meta_chars = 1;

It's not recommend to do that in PARI/GP - only for testing! Readline
has it's own routine to do switch on eightbit mode automatically (see
nls.c in readline's source code):

--------------

  /* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
     to decide the defaults for 8-bit character input and output.
     Returns  1 if we set eight-bit mode. */

  int _rl_init_eightbit ()
  {
     ...
-------------

It seems that readline for Windows isn't initialized properly during
startup.

LG - Jens

BTW: Codepages must be set furthermore bei PARI/GP in order to make
special chars working. Readline doesn't do it.