如何在 Ubuntu 和 Windows 上为德语元音变音配置 git 编码?
我注意到,当我在 Windows 上的 Git Bash 中运行 git log
时,包含德语变音的提交消息无法正确显示。这些提交是在 Ubuntu 上使用终端进行的。通常情况下,提交消息都是用英文写的,但是当涉及到名称时就没有办法了,例如 Simon Jünker 添加的库。
我猜它也可以是 Git Bash ,无法处理字符编码。但也许有一个设置可以强制使用 utf-8
编码在 Git 的任何模块(Git Gui、Git k)中写入和显示文本。
您的 Git 多平台字符编码设置是什么?请确保在您的答案中包含两个平台的配置。您还可以添加 MacOS。
I noticed that commit messages that contain German Umlaute are not displayed correctly when I run git log
in Git Bash on Windows. Those commits were made on Ubuntu using the Terminal. Normally, commit messages are written in English but when it comes to names there is no way around, e.g. Added library by Simon Jünker.
I guess it can also be Git Bash which cannot handle the character encoding. But maybe there is a setting to force utf-8
encoding for writing and displaying text in any module (Git Gui, Git k) of Git.
What is your multi-platform character encoding setup for Git? Please, make sure to include the configuration for both platforms in your answer. You can also add MacOS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此链接显示了解决此问题的方法:
请尝试:
在 Windows 命令 Shell (cmd.exe) 中再次运行 git 命令。
This link showed the way to solve this issue:
Please try:
in the Windows command Shell (cmd.exe) and run the git commands again.
尝试使用以下命令之一在 GIT Bash 提示符下设置 git config:
如果团队中有人使用其他编码,则会出现不匹配。
Petra 使用 utf8:
Karl 使用 cp1252:
Sara 检查推送的分支,根据她的编码,她将看到其中一条消息格式正确,而另一条消息格式错误。
Try to set git config on GIT Bash prompt with one of the following commands:
If somone in your team uses another encoding, you will have a missmatch.
Petra uses utf8:
Karl uses cp1252:
Sara checks out the pushed branch and depending on her encoding she will see one of the messages wellformed and the other missformed.
在 Mac OS X 上,只要您在“首选项”>“编码”中设置了编码,内置终端就可以正常工作。设置>高级,并且您选择了“启动时设置区域设置环境变量”。 (这些是默认值。)
显然,Windows 上的 MSysGit 不支持 UTF-8,但是如果您通过 cygwin 的
less
副本通过管道传输 git 命令输出,事情就会起作用。 msysgit Google 论坛中有一些有用的信息。On Mac OS X things should work fine with the built-in terminal as long as you have the encoding set in Preferences > Settings > Advanced and you’ve selected “Set locale environment variables on startup.” (These are the defaults.)
Apparently MSysGit on Windows doesn’t support UTF-8, but if you pipe git command output through a copy of
less
from cygwin things will work. There’s some useful info in the msysgit Google Group.