Skip to content

Commit

Permalink
Fix utf8 and symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Nov 17, 2014
1 parent 19c34bf commit 54fc2e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/raven/processor/utf8conversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def process(value)
def clean_invalid_utf8_bytes(obj)
if obj.respond_to?(:to_utf8)
obj.to_utf8
elsif obj.respond_to?(:encoding)
elsif obj.respond_to?(:encoding) && obj.is_a?(String)
obj.encode('UTF-16', :invalid => :replace, :undef => :replace, :replace => '').encode('UTF-8')
else
obj
Expand Down
7 changes: 7 additions & 0 deletions spec/raven/processors/utf8conversion_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,12 @@
results = @processor.process(data)
expect(results[2][1]).to eq("invalid utf8 string goes here")
end

it 'should not blow up on strings' do
data = {:key => :value}

results = @processor.process(data)
expect(results[:key]).to eq()
end
end
end

0 comments on commit 54fc2e3

Please sign in to comment.