Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
c723184a09a4
Commit
12c01d74
authored
Nov 30, 2011
by
Saito
Browse files
fix encode bugs on diff not utf-8 encode's code
parent
a8d0f5ca4614
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/views/commits/_text_file.html.haml
View file @
c723184a
...
...
@@ -2,7 +2,7 @@
-
line_new
=
0
-
lines_arr
=
diff
.
diff
.
lines
.
to_a
-
lines_arr
.
each
do
|
line
|
-
encode
(
line
)
-
line
=
encode
(
line
)
-
next
if
line
.
match
(
/^--- \/dev\/null/
)
-
next
if
line
.
match
(
/^--- a/
)
-
next
if
line
.
match
(
/^\+\+\+ b/
)
...
...
lib/utils.rb
View file @
c723184a
...
...
@@ -29,12 +29,12 @@ def encode(string)
module
Colorize
include
CharEncode
def
colorize
system_colorize
(
encode
(
data
)
,
name
)
system_colorize
(
data
,
name
)
end
def
system_colorize
(
data
,
file_name
)
ft
=
handle_file_type
(
file_name
)
Pygments
.
highlight
(
data
,
:lexer
=>
ft
,
:options
=>
{
:encoding
=>
'utf-8'
,
:linenos
=>
'True'
})
Pygments
.
highlight
(
encode
(
data
)
,
:lexer
=>
ft
,
:options
=>
{
:encoding
=>
'utf-8'
,
:linenos
=>
'True'
})
end
def
handle_file_type
(
file_name
,
mime_type
=
nil
)
...
...
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