Skip to content

Commit 831698f

Browse files
committed
Properly cope with partial bytes in buffer append
1 parent 0c906ce commit 831698f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/json/stream/buffer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def initialize
2929
def <<(data)
3030
# Avoid state machine for complete UTF-8.
3131
if @buffer.empty?
32-
(+data).force_encoding(Encoding::UTF_8)
32+
data = (+data).force_encoding(Encoding::UTF_8)
3333
return data if data.valid_encoding?
3434
end
3535

0 commit comments

Comments
 (0)