Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

utf-8

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?

like image 676
Ashley Coolman Avatar asked Apr 27 '16 10:04

Ashley Coolman


1 Answers

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.

like image 109
Vampire Avatar answered Sep 29 '22 03:09

Vampire