Sha256: 2fa8ab7f33f87df8c4e34e59e7c73c0fd96bd2ef5be823b5c8ae5995f33aabe3

Contents?: true

Size: 401 Bytes

Versions: 14

Compression:

Stored size: 401 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('UTF-8', {
            :invalid => :replace,
            :undef   => :replace,
            :replace => '?'
          })
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
timber-2.0.23 lib/timber/util/string.rb
timber-2.0.22 lib/timber/util/string.rb
timber-2.0.21 lib/timber/util/string.rb
timber-2.0.20 lib/timber/util/string.rb
timber-2.0.19 lib/timber/util/string.rb
timber-2.0.17 lib/timber/util/string.rb
timber-2.0.16 lib/timber/util/string.rb
timber-2.0.15 lib/timber/util/string.rb
timber-2.0.14 lib/timber/util/string.rb
timber-2.0.12 lib/timber/util/string.rb
timber-2.0.11 lib/timber/util/string.rb
timber-2.0.10 lib/timber/util/string.rb
timber-2.0.9 lib/timber/util/string.rb
timber-2.0.8 lib/timber/util/string.rb