mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-22 11:06:10 +10:00
Force of markup output to be the input encoding
This commit is contained in:
@@ -221,7 +221,8 @@ module ApplicationHelper
|
||||
end
|
||||
|
||||
def render_markup(file_name, file_content)
|
||||
GitHub::Markup.render(file_name, file_content).html_safe
|
||||
GitHub::Markup.render(file_name, file_content).
|
||||
force_encoding(file_content.encoding).html_safe
|
||||
rescue RuntimeError
|
||||
simple_format(file_content)
|
||||
end
|
||||
|
||||
@@ -217,4 +217,13 @@ describe ApplicationHelper do
|
||||
).to eq("<a href=\"http://www.example.com\" rel=\"noreferrer nofollow\">Example</a>")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'markup_render' do
|
||||
let(:content) { 'Noël' }
|
||||
|
||||
it 'should preserve encoding' do
|
||||
content.encoding.name.should == 'UTF-8'
|
||||
expect(render_markup('foo.rst', content).encoding.name).to eq('UTF-8')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user