On 31/10/2013 12:00, Konstantin Khomoutov wrote:
On Thu, 31 Oct 2013 10:51:11 +0000
Roddie Grant <gitl...@myword.co.uk> wrote:

When I do git diff in Terminal I get output like:
-<p><E2><80><9C>SurfexPlus<E2><80><9D> is OCCA<E2><80><99>s
Care to tell us which OS is that?
Another question: do you see this in a pager or plainly rendered by
the terminal emulator?
Another question (if this really happens on a Mac): what does
`locale` run in that terminal emulator tell to you?
I'm definitely out of my depth here :-( but the answers are the
webserver is Linux (CentOS Linux 4.9), and I'm using my MacBook
(10.6.8) to connect to it with ssh.

There is a pager running in the Mac Terminal app. I usually get ":"
(which means hit spacebar to scroll) or "END".


This is of no relevance to your problem: Git generates and shows you the
diff on your local machine, the server is not involved with this in any


OK, now let's try a couple of things:

1) If you run `git diff --no-pager ...` so that the output goes plainly
    into the hands of Terminal and rendered by it directly, do you see
    those non-ASCII characters OK?

    If this works for you, `less` is the culprit so read on.

2) Try setting the LESSCHARSET environment variable to "utf-8".
    You can do this for the current Terminal session by executing

    export LESSCHARSET=utf-8

    in it before running any `git diff` command.


3) Try playing with the LESS environment variable (which, if exists,
    contains a set of command-line options for `less` to consume as if
    they vere explicitly passed to it).  The command-line option of
    interest are "-R" (better) or "-r" (worse).  Also "-X" might be of
    relevance (though I doubt it).

Thanks for all your help; it is much appreciated.

For the record, I had to use 'git --no-pager diff' rather 'git diff --no-pager'. It solved the problem, but I was connected to the server.

Using 'setenv LESSCHARSET utf-8' works, but only when I've ssh-ed to the remote web server. Making it persistent in Terminal (on the local Mac) has no effect. But if I connect to the server, then do 'setenv LESSCHARSET utf-8' before running git diff, I get the proper apostrophes etc.

I've added 'setenv LESSCHARSET utf-8' to my .tcshrc file on the web server and all is well.

Many thanks


You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to