check_encoding (REXML::Encoding)

    # File temp/encoding.rb, line 55
                    def check_encoding str
                            # We have to recognize UTF-16, LSB UTF-16, and UTF-8
                            return UTF_16 if str[0] == 254 && str[1] == 255
                            return UNILE if str[0] == 255 && str[1] == 254
                            str =~ /^\s*<?xml\s*version=(['"]).*?\2\s*encoding=(["'])(.*?)\2/um
                            return $1.upcase if $1
                            return UTF_8
                    end