aboutsummaryrefslogtreecommitdiff
path: root/html.rb
diff options
context:
space:
mode:
Diffstat (limited to 'html.rb')
-rw-r--r--html.rb35
1 files changed, 34 insertions, 1 deletions
diff --git a/html.rb b/html.rb
index 6f714df..5dbb3e6 100644
--- a/html.rb
+++ b/html.rb
@@ -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"