Reputation: 1047
I find that the snap show the utf-8 encoded text as unreadable characters, the code and results like:
{-# 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 ".")
the output in browser is:
hello world! ä½ å¥½
I search stackoverflow and find there's a similar question (How to show utf8 text with snap and heist?), but it seems does not work. How can I handle this utf-8 problem ?
Upvotes: 2
Views: 56