postgresql - 在 'bytes' 中存储 postgresql 中的 Html 类型结果

标签 postgresql haskell yesod

使用 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/

相关文章:

haskell - 无点表示法、递归和模式匹配

haskell - 在 Haskell 中处理大数

haskell - 我想将 Lucid 添加到 Yesod 的 defaultLayout 中

haskell - 在测试 browserID 期间执行身份验证

postgresql - 无法找到从未知到文本的转换函数

postgresql - 在 PostgreSQL 中插入动态查询的 INTO 临时表结果

asp.net - Serilog 接收器 : Reading from json configuration not working

javascript - API -> 创建可重用函数 getAll

haskell - 如何使用 putStrLn 进行跟踪(Haskell)

haskell - shakespeare-js 无法在 Heroku 上编译