使用 yesod-0.10.1
定义:
postBlogR :: Handler RepHtml
postBlogR = do
((res, articleWidget), enctype) <- runFormPost entryForm
case res of
FormSuccess article -> do
articleId <- runDB $ insert article
setMessage $ toHtml $ (articleTitle article) <> " created"
redirect $ ArticleR articleId
_ -> defaultLayout $ do
setTitle "Please correct your entry form"
$(widgetFile "articleAddError")
数据库
Article
title Text
content Html
deriving
我得到 \x48656c6c6f2c20776f726c6421
在数据库中,如果我发布 Hello, world!
最佳答案
这个问题出现在邮件列表中(这个问题来自同一个人吗?)。不管怎样,答案就在这里:
https://groups.google.com/d/topic/yesodweb/VMGqhS1QAsk/discussion
关于postgresql - 在 'bytes' 中存储 postgresql 中的 Html 类型结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9788223/