aboutsummaryrefslogtreecommitdiff
path: root/html.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2010-01-21 14:35:28 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2010-01-21 14:35:28 +0100
commit62f5388a766644a7a51838a8cc2f9fe5f4e60e95 (patch)
tree3f0821fa6cee9339651ea73cb2e6c851d3023696 /html.rb
parentc8113bae08a602d7ed71b3a6d4164939b1054a60 (diff)
quick and dirty fix for encoding problem
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
+ {
+ "ö" => "&ouml;",
+ "ü" => "&uuml;",
+ "ä" => "&auml;",
+ "Ö" => "&Ouml;",
+ "Ü" => "&Uuml;",
+ "Ä" => "&Auml;",
+ "ß" => "&szlig;",
+ "–" => "&#8211;",
+ "„" => "&#8222;",
+ "“" => "&#8220;",
+ "”" => "&#8221;",
+ "✔" => "&#10004;",
+ "✘" => "&#10008;",
+ "◀" => "&#9664;",
+ "▶" => "&#9654;",
+ "✍" => "&#9997;",
+ "✖" => "&#10006;",
+ "•" => "&#8226;",
+ "▾" => "&#9662;",
+ "▴" => "&#9652;"
+ }.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"