File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
55## Unreleased
66
7+ ### Fixed
8+
9+ - Correctly handle multibyte-encoded string in streams
10+ Alexander Mankuta
11+
712## [ 0.10.0] [ ] - 2024-03-05
813
914### Changed
Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ def initialize(io = nil)
2323
2424 # Append data to stream.
2525 #
26- # @param io [String]
26+ # @param data [String]
2727 # @return [self]
28- def <<( io )
29- ( @stream ||= + '' ) << io
28+ def <<( data )
29+ ( @stream ||= '' . b ) << data . dup . force_encoding ( Encoding :: BINARY )
3030 @filtered_stream = nil
3131 self
3232 end
Original file line number Diff line number Diff line change 5050
5151 expect ( stream . data [ :DecodeParms ] ) . to eq [ { Predictor : 15 } ]
5252 end
53+
54+ it 'handles multibyte encoded strings correctly' do
55+ stream << '♥'
56+
57+ expect ( stream . data [ :Length ] ) . to eq 3
58+ end
5359end
You can’t perform that action at this time.
0 commit comments