diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-01-21 14:35:28 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-01-21 14:35:28 +0100 |
commit | 62f5388a766644a7a51838a8cc2f9fe5f4e60e95 (patch) | |
tree | 3f0821fa6cee9339651ea73cb2e6c851d3023696 /html.rb | |
parent | c8113bae08a602d7ed71b3a6d4164939b1054a60 (diff) |
quick and dirty fix for encoding problem
Diffstat (limited to '')
-rw-r--r-- | html.rb | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -24,7 +24,11 @@ class HTML @header = {} @header["type"] = "text/html" # @header["type"] = "application/xhtml+xml" - @header["charset"] = "utf-8" + if $cgi.accept_charset =~ /utf-8/ || $cgi.accept_charset =~ /\*/ + @header["charset"] = "utf-8" + else + @header["charset"] = "iso-8859-1" + end @body = "" @css = [] @@ -72,6 +76,35 @@ HEAD @body += bodycontent.chomp + "\n" end def out(cgi) + #FIXME: quick and dirty fix for encoding problem + { + "ö" => "ö", + "ü" => "ü", + "ä" => "ä", + "Ö" => "Ö", + "Ü" => "Ü", + "Ä" => "Ä", + "ß" => "ß", + "–" => "–", + "„" => "„", + "“" => "“", + "”" => "”", + "✔" => "✔", + "✘" => "✘", + "◀" => "◀", + "▶" => "▶", + "✍" => "✍", + "✖" => "✖", + "•" => "•", + "▾" => "▾", + "▴" => "▴" + }.each{|from,to| + @body.gsub!(from,to) + } +# @body.gsub!(/./){|char| +# code = char[0] +# code > 127 ? "&##{code};" : char +# } cgi.out(@header){ <<HEAD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |