[fpc-pascal] Pseudographics in FPC-IDE

Nikolay Nikolov nickysn at users.sourceforge.net
Wed Jun 15 22:29:00 CEST 2011

On 06/15/2011 04:15 PM, Anton Shepelev wrote:
> Nikolay Nikolov:
>> Basically,  all  it does is, it checks if the LANG
>> variable contains ґUTF-8' as a substring (not sure
>> if  it is the right way to do it, but it works for
>> Fedora,  Ubuntu,  OpenSUSE,  Mandriva  and  latest
>> Debian) and if it does, it writes UTF-8 characters
>> to the console, by  using  an  internal  CP437  to
>> UTF-8 conversion table.
> Then my guessing was correct, but in this case there
> is a better solution.  Instead  of  relying  on  the
> value of LANG, FP-IDE should directly check the con-
> sole mode. This can be  done  using  the  'kbd_mode'
> command. If the mode reported is UTF-8, then use the
> translation table, otherwise assume CP437.
> At least, this will make it more reliable with UTF-8
> consoles.
Yes, but there are still several issues:
1) It only works on the linux console. It doesn't work under xterm, 
gnome-terminal, konsole, etc and we still need a way to detect if they 
are in UTF-8 mode or not.
2) IIRC, it only checks if the keyboard input is in UTF-8 mode. What we 
actually care about is whether the console output (not input) is in 
UTF-8 mode. But I guess it's ok to assume that if the input is UTF-8, 
then then output is also most likely to be UTF-8.
3) I don't like the idea of having to invoke an external program and 
parse its output, but this could be done by directly invoking the ioctl 
that kbd_mode uses.

Do you know how many linux distros (besides Puppy Linux) would need 
this? When I came up with the 'UTF-8' string check in the LANG variable, 
I tested Fedora, Ubuntu, openSUSE, Mandriva and Debian and they all 
worked this way, so I figured it's a de facto standard.

More information about the fpc-pascal mailing list