Skip to content

Commit

Permalink
Another Ruby 1.9 encoding fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitrij Denissenko committed Aug 2, 2009
1 parent fd3ac80 commit 6a0c9cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/helpers/browse_helper.rb
Expand Up @@ -25,6 +25,8 @@ def format_properties(property_hash)

def format_code_with_line_numbers(node)
content = syntax_highlight(node)
content.force_encoding('utf-8') if RUBY_VERSION.to_f >= 1.9

lines, code = [], []

num = 0
Expand Down Expand Up @@ -82,7 +84,7 @@ def link_to_code_line(line_number)
end

def syntax_highlight(node)
syntax = CodeRay::FileType.fetch node.path, :plaintext, false
syntax = CodeRay::FileType.fetch node.path, :plaintext, false
CodeRay.scan(node.content, syntax).html
end

Expand Down

0 comments on commit 6a0c9cf

Please sign in to comment.