Method: EZML::Util#check_ezml_encoding
- Defined in:
- lib/ezml/util.rb
#check_ezml_encoding(str, &block) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ezml/util.rb', line 48 def check_ezml_encoding(str, &block) str = str.dup if str.frozen? bom, encoding = parse_ezml_magic_comment(str) if encoding; str.force_encoding(encoding) elsif bom; str.force_encoding(Encoding::UTF_8) end return check_encoding(str, &block) end |