module Haml::Util
def check_haml_encoding(str, &block)
-
(ArgumentError)- if the document declares an unknown encoding
Returns:
-
(String)- The original string encoded properly
Other tags:
- Yieldparam: msg - The error message to be raised
Other tags:
- Yield: - A block in which an encoding error can be raised.
Parameters:
-
str(String) -- The Haml template of which to check the encoding
def check_haml_encoding(str, &block) str = str.dup if str.frozen? bom, encoding = parse_haml_magic_comment(str) if encoding; str.force_encoding(encoding) elsif bom; str.force_encoding(Encoding::UTF_8) end return check_encoding(str, &block) end