Skip to content

Commit 647d6a6

Browse files
committed
Merge pull request #241 from getsentry/fix-utf8-and-symbols
Fix utf8 and symbols
2 parents c1a46cd + a81dbe9 commit 647d6a6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/raven/processor/utf8conversion.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def process(value)
1616
def clean_invalid_utf8_bytes(obj)
1717
if obj.respond_to?(:to_utf8)
1818
obj.to_utf8
19-
elsif obj.respond_to?(:encoding)
19+
elsif obj.respond_to?(:encoding) && obj.is_a?(String)
2020
obj.encode('UTF-16', :invalid => :replace, :undef => :replace, :replace => '').encode('UTF-8')
2121
else
2222
obj

spec/raven/processors/utf8conversion_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,12 @@
4848
results = @processor.process(data)
4949
expect(results[2][1]).to eq("invalid utf8 string goes here")
5050
end
51+
52+
it 'should not blow up on symbols' do
53+
data = {:key => :value}
54+
55+
results = @processor.process(data)
56+
expect(results[:key]).to eq(:value)
57+
end
5158
end
5259
end

0 commit comments

Comments
 (0)