#243370 Less does not properly format perldoc output

Package:
less
Source:
less
Description:
pager program similar to more
Submitter:
Fred Leeflang
Date:
2014-08-20 12:03:04 UTC
Severity:
normal
#243370#5
Date:
2004-04-12 18:23:35 UTC
From:
To:
Whenever using perldoc in an aterm I see escape characters
in the output. At first I thought it was related to the UTF-8
bugs reported. The TERM environment in aterm is set to rxvt.
Setting environment variables LESS=-R fixes the problem.

#243370#10
Date:
2004-04-15 09:27:52 UTC
From:
To:
Hello,

without additional information, especially the perldoc file that
contains those characters, this bug report is not very useful.

Besides that, I have doubts this is really a bug in less. Less is using
some system's functions to determine whether a given character is
"printable" or not. If the perldoc contains national language subset
characters, but your locale is set to use the ASCII character set then
it's inevitable that less shows those Escape sequences (they are used to
display "control" characters).

The option -R just forces less to output the characters no matter what
(read: at your own risk).

Thomas

#243370#15
Date:
2004-04-15 16:13:58 UTC
From:
To:
Hi,

those escape sequences should switch on and off the bold print of the
headings. It's working for me with konsole.
Do you have that problem with other terminal programs than aterm, too?

Thomas

Fred Leeflang wrote:

#243370#20
Date:
2004-04-15 18:01:35 UTC
From:
To:
Hi Thomas,

I have the same thing on gnome-terminal. I installed konsole
and it's exactly the same. BTW, when I export PAGER=more, the problem
goes away. Is there anything you would like me to check? Funny as
it sounds, I was just apt-get dist-upgrade'ing and the locales package
is asking me which locales to generate. All I have selected is
en_US ISO-8859-1 This should be sufficient?

Fred

Thomas Schoepf wrote:

#243370#25
Date:
2004-12-10 15:13:17 UTC
From:
To:
Hello Fred,

does this problem still occur?

Thomas

#243370#30
Date:
2014-08-20 09:03:46 UTC
From:
To:
-=| Thomas Schoepf, 15.04.2004 11:27:52 +0200 |=-
-=| Thomas Schoepf, 10.12.2004 16:13:17 +0100 |=-

Since perl 5.20' perldoc command switched from "man" rendering to
"term" rendering, it is quite easy to reproduce the problem:

 perldoc perlcn

In gnome-terminal, with UTF-8 locale that gives me some Chinese text
with section headings containing visible ANSI escape sequences.

Compare with:

 perldoc perlcn | more
or
 perldoc perlcn | most # requires package 'most' to be installed
or
 perldoc perlcv | less -R

I don't think this is what is happening since the locale/terminal are
fully UTF-8-aware.

I think you mean "-r" as dangerous. From less(1):

 -r or --raw-control-chars
        Causes "raw" control characters to be displayed.  The  default
        is to display control characters using the caret notation; for
        example, a control-A (octal 001) is displayed as "^A".   Warn‐
        ing: when the -r option is used, less cannot keep track of the
        actual appearance of the screen (since this depends on how the
        screen  responds  to  each  type of control character).  Thus,
        various display problems may result, such as long lines  being
        split in the wrong place.

 -R or --RAW-CONTROL-CHARS
        Like  -r, but only ANSI "color" escape sequences are output in
        "raw" form.  Unlike -r, the screen  appearance  is  maintained
        correctly  in  most  cases.  ANSI "color" escape sequences are
        sequences of the form:

             ESC [ ... m

        where the "..." is zero or more color specification characters
        For  the  purpose  of keeping track of screen appearance, ANSI
        color escape sequences are assumed to  not  move  the  cursor.
        You can make less think that characters other than "m" can end
        ANSI color escape sequences by setting the  environment  vari‐
        able  LESSANSIENDCHARS to the list of characters which can end
        a color escape sequence.  And you can  make  less  think  that
        characters other than the standard ones may appear between the
        ESC and the m by setting the environment variable LESSANSIMID‐
        CHARS to the list of characters which can appear.

So as I uderstand it, "-r" is dangerous, "-R" is safe.


What I am trying to say is that having -R be the default would be very
nice and should be safe.


Cheers,
    dam