2006-12-30 13:22:38 +03:00
|
|
|
At the core level, git is character encoding agnostic.
|
|
|
|
|
|
|
|
- The pathnames recorded in the index and in the tree objects
|
|
|
|
are treated as uninterpreted sequences of non-NUL bytes.
|
|
|
|
What readdir(2) returns are what are recorded and compared
|
|
|
|
with the data git keeps track of, which in turn are expected
|
|
|
|
to be what lstat(2) and creat(2) accepts. There is no such
|
|
|
|
thing as pathname encoding translation.
|
|
|
|
|
2008-12-19 15:14:18 +03:00
|
|
|
- The contents of the blob objects are uninterpreted sequences
|
2006-12-30 13:22:38 +03:00
|
|
|
of bytes. There is no encoding translation at the core
|
|
|
|
level.
|
|
|
|
|
2008-12-19 15:14:18 +03:00
|
|
|
- The commit log messages are uninterpreted sequences of non-NUL
|
2006-12-30 13:22:38 +03:00
|
|
|
bytes.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2008-09-03 12:50:43 +04:00
|
|
|
. 'git-commit' and 'git-commit-tree' issues
|
2008-01-03 17:18:07 +03:00
|
|
|
a warning if the commit log message given to it does not look
|
2006-12-30 13:22:38 +03:00
|
|
|
like a valid UTF-8 string, unless you explicitly say your
|
|
|
|
project uses a legacy encoding. The way to say this is to
|
2007-02-18 12:36:51 +03:00
|
|
|
have i18n.commitencoding in `.git/config` file, like this:
|
2006-12-30 13:22:38 +03:00
|
|
|
+
|
|
|
|
------------
|
2007-02-18 12:36:51 +03:00
|
|
|
[i18n]
|
2006-12-30 13:22:38 +03:00
|
|
|
commitencoding = ISO-8859-1
|
|
|
|
------------
|
|
|
|
+
|
|
|
|
Commit objects created with the above setting record the value
|
2007-02-18 12:36:51 +03:00
|
|
|
of `i18n.commitencoding` in its `encoding` header. This is to
|
2006-12-30 13:22:38 +03:00
|
|
|
help other people who look at them later. Lack of this header
|
|
|
|
implies that the commit log message is encoded in UTF-8.
|
|
|
|
|
2008-10-22 00:55:57 +04:00
|
|
|
. 'git-log', 'git-show', 'git-blame' and friends look at the
|
|
|
|
`encoding` header of a commit object, and try to re-code the
|
|
|
|
log message into UTF-8 unless otherwise specified. You can
|
2006-12-30 13:22:38 +03:00
|
|
|
specify the desired output encoding with
|
2007-02-18 12:36:51 +03:00
|
|
|
`i18n.logoutputencoding` in `.git/config` file, like this:
|
2006-12-30 13:22:38 +03:00
|
|
|
+
|
|
|
|
------------
|
2007-02-18 12:36:51 +03:00
|
|
|
[i18n]
|
2006-12-30 13:22:38 +03:00
|
|
|
logoutputencoding = ISO-8859-1
|
|
|
|
------------
|
|
|
|
+
|
|
|
|
If you do not have this configuration variable, the value of
|
2007-02-18 12:36:51 +03:00
|
|
|
`i18n.commitencoding` is used instead.
|
2006-12-30 13:22:38 +03:00
|
|
|
|
|
|
|
Note that we deliberately chose not to re-code the commit log
|
|
|
|
message when a commit is made to force UTF-8 at the commit
|
|
|
|
object level, because re-coding to UTF-8 is not necessarily a
|
|
|
|
reversible operation.
|