From ff11fc2c46c2611a06ab7b84b8d502be88519d01 Mon Sep 17 00:00:00 2001 From: ross Date: Mon, 10 Jan 2005 19:18:22 +0000 Subject: [haddock @ 2005-01-10 19:18:22 by ross] Render non-ASCII characters using numeric character references, to simplify charset issues. There's a META tag saying the charset is UTF-8, but GHC outputs characters as raw bytes. Ideally we need an encoding on the input side too, primarily in comments, because source files containing non-ASCII characters aren't portable between locales. --- src/Html.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Html.hs') diff --git a/src/Html.hs b/src/Html.hs index f4efa218..ae14c9ae 100644 --- a/src/Html.hs +++ b/src/Html.hs @@ -19,6 +19,9 @@ module Html ( import qualified BlockTable as BT +import Data.Char (isAscii, ord) +import Numeric (showHex) + infixr 2 +++ -- combining Html infixr 7 << -- nesting Html infixl 8 ! -- adding optional arguments @@ -152,7 +155,9 @@ stringToHtmlString = concatMap fixChar fixChar '>' = ">" fixChar '&' = "&" fixChar '"' = """ - fixChar c = [c] + fixChar c + | isAscii c = [c] + | otherwise = "&#x" ++ showHex (ord c) ";" -- --------------------------------------------------------------------------- -- Classes -- cgit v1.2.3