less with color and locale

0

Using cygwin I've a problem in less: I can't see colors (for example using grep --color) and I can't set the locale I'm using (LC_ALL=C).

I type this command:

echo òùàòùàòà | grep --color àò | sort | less -R

and the result is:

<C3><B2><C3><B9><C3><A0><C3><B2><C3><B9><C3><A0><C3><B2><C3><A0>

EDIT: This work:

ls --color=yes | less -R

less --version -> 444

EDIT2: solved the problem of colors using the option --color=always, but not solved the problem of locale. Less with colors but strange output

Alberto

Posted 2012-02-25T11:10:10.810

Reputation: 365

Answers

1

I can't test this on Cygwin at the moment, but both of these solutions worked for me on Fedora.

echo òùàòùàòà | grep --color=always àò | sort | LC_ALL=en_US.UTF-8 less -R

echo òùàòùàòà | grep --color=always àò | sort | LESSCHARSET=utf-8 less -R

UPDATE:

Just verified that the above work using Cygwin 1.7.9 on Windows XP SP3.

garyjohn

Posted 2012-02-25T11:10:10.810

Reputation: 29 085