Skip to content

Commit

Permalink
Temp Fix for some encoding errors
Browse files Browse the repository at this point in the history
I call this temporary because there are still some issues displaying
UTF-8 characters and, overall it just feels hacky.  That said,
submissions with UTF-8 characters won't break the page now, which is
progress on #251.

I'd suggest a more thorough examination of our current encoding
situation in the future.
  • Loading branch information
dlbucci committed Feb 5, 2015
1 parent 275e615 commit b6b6947
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def annotated_file(file, filename, position)
conditions[:position] = position if position
annotations = self.annotations.where(conditions)

result = file.lines.map { |line| [line, nil] }
result = file.lines.map { |line| [line.force_encoding("UTF-8"), nil] }

# annotation lines are one-indexed, so adjust for the zero-indexed array
annotations.each { |a| result[a.line-1][1] = a}
Expand Down

0 comments on commit b6b6947

Please sign in to comment.