Safe to use any utf-8 character in git commit messages?

一曲冷凌霜 提交于 2020-06-27 08:07:42

问题


I find it useful to use UTF8 characters such as ❌ (see here) in commit messages.

refactor (NewService): Added better service & ❌ OldServiceA

From what I can see, it seems fine. But I want to check if I'm opening myself up to any significant interoperability issues (CI tools, different OS's etc).

Does anyone consider this safe/unsafe?


回答1:


From https://git-scm.com/docs/git-commit:

Commit log messages are typically encoded in UTF-8, but other extended ASCII encodings are also supported. This includes ISO-8859-x, CP125x and many others, but not UTF-16/32, EBCDIC and CJK multi-byte encodings (GBK, Shift-JIS, Big5, EUC-x, CP9xx etc.).

Although we encourage that the commit log messages are encoded in UTF-8, both the core and Git Porcelain are designed not to force UTF-8 on projects. If all participants of a particular project find it more convenient to use legacy encodings, Git does not forbid it. However, there are a few things to keep in mind.

and so on.
So as long as you do not set some configuration parameter for all people using a repository, it should be safe to assume UTF-8 as encoding for commit messages.



来源:https://stackoverflow.com/questions/36886871/safe-to-use-any-utf-8-character-in-git-commit-messages

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!