Sha256: a5c7353473f820785a3f937ce6783bc379e36c30fa3983d148d562eb92ff2048

Contents?: true

Size: 398 Bytes

Versions: 4

Compression:

Stored size: 398 Bytes

Contents

module Timber
  module Util
    # @private
    module String
      UTF8 = "UTF-8".freeze

      # @private
      def self.normalize_to_utf8(string)
        if string.encoding.to_s == UTF8
          string
        else
          string.encode(UTF8, {
            :invalid => :replace,
            :undef   => :replace,
            :replace => '?'
          })
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
timber-2.1.0.rc3 lib/timber/util/string.rb
timber-2.1.0.rc2 lib/timber/util/string.rb
timber-2.1.0.rc1 lib/timber/util/string.rb
timber-2.0.24 lib/timber/util/string.rb