如何在git log中显示不同的语言字符? [英] how to show different language characters in git log?
问题描述
这是我现在在git日志中看到的内容:
Here is what I am seeing now in my git log:
commit d0ed97d243eaf905b03244a4d1ba6af26213e4ad
Author: some guy <someone@somesite.com>
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.
我已经将我的LANG env更改为ja_JP.UTF-8,en_US.UTF-8,ja_JP.eucJP:
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
但没有任何效果.
希望有人知道并给我一些观点.
谢谢
UPDATE(解决方案1):
Hope someone knows and give me some points.
Thanks.
UPDATE (solution 1):
最后,我设法通过注释掉本地环境(MacOS)的/etc/ssh_config
文件中的SendEnv LANG LC_*
行来显示那些日语字符.
但是我不认为我解决了这个问题.我想我只是切断了将LANG设置发送到服务器端(CentOS)的方式.因此,基本上,本地环境中的LANG设置仍然混乱,因为当我在本地环境(mac)中尝试$ locale
时,它显示了以下设置:
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=
这显然是不合适的设置.
我仍然在闲逛...
更新(解决方案2):
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.
推荐答案
确保您的系统正确支持UTF-8.大多数Ubuntu和Fedora机器都可以.如果使用终端或ssh会话,请确保将ssh客户端配置为完全使用UTF-8
.例如,如果使用putty
,请确保将其配置为在首选项中使用UTF-8
编码-这不是默认设置.
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.
在此Fedora 16机器上,我具有相对较旧的git版本1.7.7.6,但只要我正确设置了区域设置,它似乎就可以正常工作:
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 <someone@somesite.com>
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 <someone@somesite.com>
Date: Wed Jun 5 22:57:10 2013 -0700
welcome
привет
ヘッダのユー
但是如果我将语言环境设置为Posix(C
),则会中断:
But it breaks if I set locale to Posix (C
):
$ export LANG=C
$ git log
commit 40b8cb9fc58775826a511c5338370f7fd1454481
Author: some guy <someone@somesite.com>
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=
这篇关于如何在git log中显示不同的语言字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!