diff --git a/app/views/refs/_tree.html.haml b/app/views/refs/_tree.html.haml
index 0d9d2d7541d50eae28bb470d7d02ed4705387f72..ee2f278693c2acda2504eadb2bb7a4b854418d31 100644
--- a/app/views/refs/_tree.html.haml
+++ b/app/views/refs/_tree.html.haml
@@ -42,9 +42,9 @@
.readme
- if content.name =~ /\.(md|markdown)$/i
= preserve do
- = markdown(content.data.detect_encoding!)
+ = markdown(content.data)
- else
- = simple_format(content.data.detect_encoding!)
+ = simple_format(content.data)
- if params[:path]
- history_path = tree_file_project_ref_path(@project, @ref, params[:path])
diff --git a/app/views/refs/_tree_file.html.haml b/app/views/refs/_tree_file.html.haml
index cb8a1193e7fafbab6eeead6911775332b787a321..201028dc2ab9353b3e44e149378fb58863e33042 100644
--- a/app/views/refs/_tree_file.html.haml
+++ b/app/views/refs/_tree_file.html.haml
@@ -13,7 +13,7 @@
#tree-readme-holder
.readme
= preserve do
- = markdown(file.data.detect_encoding!)
+ = markdown(file.data)
- else
.view_file_content
- unless file.empty?