GitLab 5.2: View commit fails with 500 Encoding Error for commit with UTF-16 encoded file Content (but normal filename)
Created by: sroth80021
Using GitLab 5.2, if you create a utf-16 encoded text file (say for Japanese), you can push successfully, but you when you view the commit in GitLab, you get the message: "500 Encoding Error -- Page can't be loaded because of an encoding error"
production log:
Started GET "/sandbox/commit/748b46e200be4143325218839bfce5083534ef1e" for 127.0.0.1 at 2013-06-06 09:07:27 -0700
Processing by CommitController#show as HTML
Parameters: {"project_id"=>"sandbox", "id"=>"748b46e200be4143325218839bfce5083534ef1e"}
Rendered commit/_commit_box.html.haml (3.4ms)
Rendered commits/_diff_head.html.haml (0.1ms)
Rendered notes/_diff_note_link.html.haml (0.7ms)
Rendered notes/_diff_note_link.html.haml (0.4ms)
Rendered notes/_diff_note_link.html.haml (0.4ms)
Rendered commits/_text_file.html.haml (4.0ms)
Rendered commits/_diffs.html.haml (8.5ms)
Rendered notes/_form.html.haml (2.7ms)
Rendered notes/_notes_with_form.html.haml (5.4ms)
Rendered commit/show.html.haml within layouts/project_resource (25.0ms)
Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT):
app/views/commit/show.html.haml:12:in `_app_views_commit_show_html_haml__4314990388023696640_69902842911760'
Rendered errors/encoding.html.haml within layouts/errors (0.1ms)
Rendered layouts/_head.html.haml (1.2ms)
Rendered layouts/_search.html.haml (19.5ms)
Rendered layouts/_head_panel.html.haml (23.2ms)
Rendered layouts/_flash.html.haml (0.1ms)
Completed 500 Internal Server Error in 85ms (Views: 24.2ms | ActiveRecord: 2.5ms)
Started GET "/sandbox/commit/748b46e200be4143325218839bfce5083534ef1e?ref=master&limit=40&offset=160&_=1370534847577" for 127.0.0.1 at 2013-06-06 09:07:28 -0700
Processing by CommitController#show as JS
Parameters: {"ref"=>"master", "limit"=>"40", "offset"=>"160", "_"=>"1370534847577", "project_id"=>"sandbox", "id"=>"748b46e200be4143325218839bfce5083534ef1e"}
Rendered commit/_commit_box.html.haml (3.5ms)
Rendered commits/_diff_head.html.haml (0.1ms)
Rendered notes/_diff_note_link.html.haml (0.7ms)
Rendered notes/_diff_note_link.html.haml (0.5ms)
Rendered notes/_diff_note_link.html.haml (0.6ms)
Rendered commits/_text_file.html.haml (4.4ms)
Rendered commits/_diffs.html.haml (8.6ms)
Rendered notes/_form.html.haml (2.5ms)
Rendered notes/_notes_with_form.html.haml (5.0ms)
Rendered commit/show.html.haml within layouts/project_resource (25.0ms)
Encoding::CompatibilityError (incompatible character encodings: UTF-8 and ASCII-8BIT):
app/views/commit/show.html.haml:12:in `_app_views_commit_show_html_haml__4314990388023696640_69902842911760'
Rendered errors/encoding.html.haml within layouts/errors (0.1ms)
Rendered layouts/_head.html.haml (1.1ms)
Rendered layouts/_search.html.haml (22.9ms)
Rendered layouts/_head_panel.html.haml (26.5ms)
Rendered layouts/_flash.html.haml (0.1ms)
Completed 500 Internal Server Error in 87ms (Views: 26.9ms | ActiveRecord: 2.8ms)
Repro Steps:
-
clone repo, create/copy file (see gist below for the file I used) with UTF-16 encoding. On linux, the 'file' command reports: $ file test.txt test.txt: Little-endian UTF-16 Unicode text, with CR line terminators
-
commit, push file
-
in GitLab, click on the commit.
Result: 500 Encoding Error -- Page can't be loaded because of an encoding error
Expected Result: text displays properly, or at least a better message says it cannot be displayed.
Note that the file can actually be viewed, by clicking on the Files tab, and navigating to the file. It's just the commit page which seems to be broken.