可以快照处理utf8文本?

时间:2015-05-04 13:23:12

标签: haskell utf-8 haskell-snap-framework

我发现snap将utf-8编码的文本显示为不可读的字符,代码和结果如:

{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text as T

...

site :: Snap ()
site =
    ifTop (writeText $ T.pack "hello world! 你好") <|> -- Here is the utf-8 text
    route [ ("foo", writeBS "bar")
          , ("query/:pat", echoHandler)
          ] <|> 
    dir "static" (serveDirectory ".")

浏览器中的输出是:

hello world! ä½ å¥½

我搜索stackoverflow并发现有一个类似的问题(How to show utf8 text with snap and heist?),但它似乎不起作用。我该如何处理这个utf-8问题?

0 个答案:

没有答案