def out(options = "text/html")
options = { "type" => options } if options.kind_of?(String)
content = yield
if options.has_key?("charset")
require "nkf"
case options["charset"]
when /iso-2022-jp/ni
content = NKF::nkf('-m0 -x -j', content)
options["language"] = "ja" unless options.has_key?("language")
when /euc-jp/ni
content = NKF::nkf('-m0 -x -e', content)
options["language"] = "ja" unless options.has_key?("language")
when /shift_jis/ni
content = NKF::nkf('-m0 -x -s', content)
options["language"] = "ja" unless options.has_key?("language")
end
end
options["length"] = content.length.to_s
output = stdoutput
output.binmode if defined? output.binmode
output.print header(options)
output.print content unless "HEAD" == env_table['REQUEST_METHOD']
end