@@ -8,7 +8,6 @@ import Control.Monad (when)
88import qualified Data.ByteString as S
99import qualified Data.Text as T
1010import qualified Data.Text.IO as TIO
11−import qualified Data.ByteString.Lazy.Char8 as L8
1211import Data.Conduit
1312import Data.Conduit.Network (HostPreference)
1413import GHC.IO.Exception (IOErrorType(..))
@@ -19,6 +18,8 @@ import Network.Wai.Handler.Warp.Timeout
1918import Network.Wai.Handler.Warp.Types
2019import System.IO (stderr)
2120import System.IO.Error (ioeGetErrorType)
21+import qualified Data.Text.Lazy as TL
22+import qualified Data.Text.Lazy.Encoding as TLE
2223
2324-- | Various Warp server settings. This is purposely kept as an abstract data
2425-- type so that new settings can be added without breaking backwards
@@ -98,11 +99,11 @@ defaultExceptionHandler _ e =
9899 $ TIO.hPutStrLn stderr $ T.pack $ show e
99100
100101defaultExceptionResponse :: SomeException -> Response
101−defaultExceptionResponse _ = responseLBS H.internalServerError500 [(H.hContentType, "text/plain")] "Something went wrong"
102+defaultExceptionResponse _ = responseLBS H.internalServerError500 [(H.hContentType, "text/plain; charset=utf-8")] "Something went wrong"
102103
103104-- | Default implementation of 'settingsOnExceptionResponse' for the debugging purpose. 500, text/plain, a showed exception.
104105exceptionResponseForDebug :: SomeException -> Response
105−exceptionResponseForDebug e = responseLBS H.internalServerError500 [(H.hContentType, "text/plain")] (L8.pack $ "Exception: " ++ show e)
106+exceptionResponseForDebug e = responseLBS H.internalServerError500 [(H.hContentType, "text/plain; charset=utf-8")] (TLE.encodeUtf8 $ TL.pack $ "Exception: " ++ show e)
106107
107108{-# DEPRECATED settingsPort "Use setPort instead" #-}
108109{-# DEPRECATED settingsHost "Use setHost instead" #-}