diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-08-13 14:04:11 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-08-13 14:21:18 +0200 |
commit | 394ed7006ee5dc8bddfd132b64001d5dfc0ffdd3 (patch) | |
tree | ba71450a7f5d95bc524d87056e81efa4b6ac6c9e /lib/git/objects/fun.py | |
parent | 192472f9673b18c91ce618e64e935f91769c50e7 (diff) | |
download | gitpython-394ed7006ee5dc8bddfd132b64001d5dfc0ffdd3.tar.gz |
unicode handling in messages and trees was improved. Messages are now written according to the encoding of the commit object, and decoded using that information as well. Trees will encode and decode their names with utf8
Diffstat (limited to 'lib/git/objects/fun.py')
-rw-r--r-- | lib/git/objects/fun.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/git/objects/fun.py b/lib/git/objects/fun.py index e73e93b0..9b0a377c 100644 --- a/lib/git/objects/fun.py +++ b/lib/git/objects/fun.py @@ -66,7 +66,14 @@ def tree_entries_from_data(data): while data[i] != '\0': i += 1 # END while not reached NULL + + # default encoding for strings in git is utf8 + # Only use the respective unicode object if the byte stream was encoded name = data[ns:i] + name_enc = name.decode("utf-8") + if len(name) > len(name_enc): + name = name_enc + # END handle encoding # byte is NULL, get next 20 i += 1 |