diff options
Diffstat (limited to 'components/stream.rb')
-rw-r--r-- | components/stream.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/components/stream.rb b/components/stream.rb index 45c4a2b..347eb87 100644 --- a/components/stream.rb +++ b/components/stream.rb @@ -7,7 +7,12 @@ module NanoBot class Stream < StringIO def write(*args) if @callback - @accumulated += args.first + begin + @accumulated += args.first + rescue StandardError => _e + @accumulated = "#{@accumulated.force_encoding('UTF-8')}#{args.first.force_encoding('UTF-8')}" + end + @callback.call(@accumulated, args.first, false) end super |