こんにちは。
おそらく、テキストデータがバイナリとみなされてるからではないでしょうか?
String#is_binary_data?
の中で、「" ".."~"(表示可能な ASCII 文字)もしくは改行コード」以外が 3 割を越えて含まれるようなデータか、
\x00なデータが含まれてるとバイナリとみなされてダウンロードになると思います。
基本的に ASCII以外の日本語(マルチバイト文字) は表示されて欲しいという場合は
\x00 なデータが含まれてる場合のみダウンロードになるようにしてみるといいかもしれません。
過去に作ったパッチなので様子于とかあわないかもしれませんが参考にしてください。
Index: app/controllers/repositories_controller.rb
===================================================================
--- app/controllers/repositories_controller.rb (revision 1709)
+++ app/controllers/repositories_controller.rb (working copy)
@@ -102,7 +102,7 @@
@content = @
repository.cat(@path, @rev)
show_error_not_found and return unless @content
- if 'raw' == params[:format] || @content.is_binary_data?
+ if 'raw' == params[:format] || @content.include?("\x00")
# Force the download if it's a binary file
send_data @content, :filename => @path.split('/').last
else
では。