Skip to content

Commit

Permalink
force error message to be utf-8. yajl would return ascii-8bit
Browse files Browse the repository at this point in the history
  • Loading branch information
godfat committed Jul 2, 2014
1 parent ada71dd commit 546db2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/rest-core/middleware/json_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def self.members; [:json_response]; end
class ParseError < Json.const_get(:ParseError)
attr_reader :cause, :body
def initialize cause, body
super("#{cause.message}\nOriginal text: #{body}")
msg = cause.message.force_encoding('utf-8')
super("#{msg}\nOriginal text: #{body}")
@cause, @body = cause, body
end
end
Expand Down

0 comments on commit 546db2e

Please sign in to comment.