Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
8265d43d
Commit
8265d43d
authored
Jul 31, 2014
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force of markup output to be the input encoding
parent
e794b561
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+2
-1
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+9
-0
No files found.
app/helpers/application_helper.rb
View file @
8265d43d
...
...
@@ -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
...
...
spec/helpers/application_helper_spec.rb
View file @
8265d43d
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment