Gitlab::Encode.utf8 should be aware of encoding header in commits.
Created by: akzhan
I should note that Git saves commit messages in any encoding.
Typically it is UTF-8, but it depends on commit author locale settings.
Git adds encoding header to the commit if commit message encoding isn't utf-8.
So Gitlab::Encode.utf8 or CommitDecorator should be aware of encoding header.
Now Gitlab simply dies to some commit messages like KOI-8R.
It looks like:
2012-08-02_09:10:32.16501 unknown header 'encoding' in commit b18d6d46f37e4756a238cc209d1231952cb80088 2012-08-02_09:10:32.16518 unknown header 'encoding' in commit b18d6d46f37e4756a238cc209d1231952cb80088 2012-08-02_09:10:32.16631 unknown header 'encoding' in commit 48d876f5d6982faaea2915d72d21753b8134c052 2012-08-02_09:10:32.43345 Completed 500 Internal Server Error in 797ms 2012-08-02_09:10:32.43614 2012-08-02_09:10:32.43615 ActionView::Template::Error (unknown encoding name - ISO-8859-8-I): 2012-08-02_09:10:32.43616 8: %strong.cgray= commit.author_name 2012-08-02_09:10:32.43617 9: – 2012-08-02_09:10:32.43617 10: = image_tag gravatar_icon(commit.author_email), :class => "avatar", :width => 16 2012-08-02_09:10:32.43618 11: %span.row_title= truncate(commit.title, :length => 50) 2012-08-02_09:10:32.43618 12: 2012-08-02_09:10:32.43619 13: %span.committed_ago 2012-08-02_09:10:32.43619 14: = time_ago_in_words(commit.committed_date) 2012-08-02_09:10:32.43620 lib/gitlab/encode.rb:51:in `force_encoding'
Line number in Encode is not like your master because I did some modifications of code to do it more encodings friendly.