Sha256: d1f5eeb4afb58ef97163694c92abd0e72a21dfe56594c2291511c13fea664fda

Contents?: true

Size: 266 Bytes

Versions: 18

Compression:

Stored size: 266 Bytes

Contents

module RubySMB
  module Utils

    def self.safe_encode(str, encoding)
      str.encode(encoding)
    rescue EncodingError
      if str.encoding == ::Encoding::ASCII_8BIT
        str.dup.force_encoding(encoding)
      else
        raise
      end
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ruby_smb-3.3.10 lib/ruby_smb/utils.rb
ruby_smb-3.3.9 lib/ruby_smb/utils.rb
ruby_smb-3.3.7 lib/ruby_smb/utils.rb
ruby_smb-3.3.6 lib/ruby_smb/utils.rb
ruby_smb-3.3.5 lib/ruby_smb/utils.rb
ruby_smb-3.3.4 lib/ruby_smb/utils.rb
ruby_smb-3.3.3 lib/ruby_smb/utils.rb
ruby_smb-3.3.2 lib/ruby_smb/utils.rb
ruby_smb-3.3.1 lib/ruby_smb/utils.rb
ruby_smb-3.3.0 lib/ruby_smb/utils.rb
ruby_smb-3.2.8 lib/ruby_smb/utils.rb
ruby_smb-3.2.7 lib/ruby_smb/utils.rb
ruby_smb-3.2.6 lib/ruby_smb/utils.rb
ruby_smb-3.2.5 lib/ruby_smb/utils.rb
ruby_smb-3.2.4 lib/ruby_smb/utils.rb
ruby_smb-3.2.3 lib/ruby_smb/utils.rb
ruby_smb-3.2.2 lib/ruby_smb/utils.rb
ruby_smb-3.2.1 lib/ruby_smb/utils.rb