Sha256: 3392f32ef6d2182bba6e2a38107bca219f757fdbe7864aaff3e98935c5c4f227
Contents?: true
Size: 437 Bytes
Versions: 6
Compression:
Stored size: 437 Bytes
Contents
module Temple module Filters # Remove BOM from input string # # @api public class RemoveBOM < Parser def call(s) if s.respond_to?(:encoding) if s.encoding.name =~ /^UTF-(8|16|32)(BE|LE)?/ s.gsub(Regexp.new("\\A\uFEFF".encode(s.encoding.name)), '') else s end else s.gsub(/\A\xEF\xBB\xBF/, '') end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems