Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show different language characters in git log?

Here is what I am seeing now in my git log:

commit d0ed97d243eaf905b03244a4d1ba6af26213e4ad
Author: some guy <[email protected]>
Date:   Mon Jun 3 11:22:06 2013 +0900

<E3><83><98><E3><83><83><E3><83><80><E3><81><AE><E3><83><A6><E3><83><BC><E3><82><B6><E3><82><A2><E3><82><A4><E3><82><B3><E3><83><B3><E8><A1><A8><E7><A4><BA>

the commit is made by some Japanese characters.

I've already changed my LANG env to ja_JP.UTF-8, en_US.UTF-8, ja_JP.eucJP:

$ export LANG=ja_JP.UTF-8

but nothing worked.

Hope someone knows and give me some points. Thanks.


UPDATE (solution 1):

Finally, I managed to show those Japanese characters by commenting out the line SendEnv LANG LC_* in /etc/ssh_config file in the local environment(which is MacOS). But I don't think I solved this issue. I think I just cut off the way of sending the settings of LANG to the server side(CentOS). So basically, the LANG settings in the local env is still messing up because when I tried $ locale in the local env(mac), it shows the following settings:

LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Which is obviously a inappropriate setting.
I am still undering goggling...


UPDATE (solution 2):

I finally find the solution to the "locale" issue,
here is the link I find:How to fix locale issues in Mac OSX terminal
Thanks for all the help from all the people here.

like image 287
inexcii Avatar asked Oct 25 '25 09:10

inexcii


1 Answers

Make sure that your system supports UTF-8 properly. Most Ubuntu and Fedora boxes do. If you are using terminal or ssh session, make sure that your ssh client is configured to use UTF-8 all the way. For example, if using putty, be sure to configure it to use UTF-8 encoding in preferences - it is not a default setting.

I have relatively old git version 1.7.7.6 on this Fedora 16 box, but it seems to work just fine, as long as I set my locale properly:

$ export LANG=en_US.UTF-8
$ git log
commit 40b8cb9fc58775826a511c5338370f7fd1454481
Author: some guy <[email protected]>
Date:   Wed Jun 5 22:57:10 2013 -0700

welcome
привет
ヘッダのユー

It still works the same if I set locale to Japanese:

$ export LANG=ja_JP.UTF-8
$ git log
commit 40b8cb9fc58775826a511c5338370f7fd1454481
Author: some guy <[email protected]>
Date:   Wed Jun 5 22:57:10 2013 -0700

welcome
привет
ヘッダのユー

But it breaks if I set locale to Posix (C):

$ export LANG=C
$ git log
commit 40b8cb9fc58775826a511c5338370f7fd1454481
Author: some guy <[email protected]>
Date:   Wed Jun 5 22:57:10 2013 -0700

welcome
<D0><BF><D1><80><D0><B8><D0><B2><D0><B5><D1><82>
<E3><83><98><E3><83><83><E3><83><80><E3><81><AE><E3><83><A6><E3><83><BC>

For reference, this is what working locale should look like:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
like image 136
mvp Avatar answered Oct 27 '25 00:10

mvp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!