James Tauber

journeyman of some

blog > 2006 > 04 > 16 >

Getting less to work with UTF-8

I've been working with UTF-8 files on the 'nix command-line for years, most recently on OS X.

I've been frustrated that things like cat and head work fine once Terminal is set to display UTF-8 but less doesn't seem to recognize UTF-8 even in that case.

I finally got around asking Google for a solution.

20 seconds later, I found it:

export LC_CTYPE="en_US.UTF-8"

via Notes on UTF-8 and locales

Boy do I feel stupid for not just looking it up earlier!

Anyway, maybe someone else will find that useful to know :-)

Comments (3)

dda on April 16, 2006:

export LESSCHARSET=utf-8

Works fine for me.

James Tauber on April 16, 2006:

Yep, LESSCHARSET works for me too (thanks for the tip!)

I presume LC_CTYPE affects a broader range of commands.

Geof on April 16, 2006:

Thanks! That's one of those things that bothered me from time to time but I never thought to look it up either.

Add a Comment

Created: April 16, 2006
Last Modified: April 16, 2006
Author: jtauber