1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

String#encode accepts an Encoding

This commit is contained in:
Akira Matsuda 2013-02-08 13:02:32 +09:00
parent 121b6ae9e2
commit 74753d3870

View file

@ -109,7 +109,7 @@ module Haml
if str.valid_encoding?
# Get rid of the Unicode BOM if possible
if str.encoding.name =~ /^UTF-(8|16|32)(BE|LE)?$/
return str.gsub(Regexp.new("\\A\uFEFF".encode(str.encoding.name)), '')
return str.gsub(Regexp.new("\\A\uFEFF".encode(str.encoding)), '')
else
return str
end