Skip to content

Commit

Permalink
Use official decodeUtf8Lenient from text >= 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fumieval committed Oct 15, 2023
1 parent 07b0035 commit b0ac85c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Web/Scotty/Util.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}
module Web.Scotty.Util
( lazyTextToStrictByteString
Expand Down Expand Up @@ -34,8 +35,10 @@ lazyTextToStrictByteString = ES.encodeUtf8 . TL.toStrict
strictByteStringToLazyText :: B.ByteString -> TL.Text
strictByteStringToLazyText = TL.fromStrict . ES.decodeUtf8With ES.lenientDecode

#if !MIN_VERSION_text(2,0,0)
decodeUtf8Lenient :: B.ByteString -> TP.Text
decodeUtf8Lenient = ES.decodeUtf8With ES.lenientDecode
#endif

-- Note: we currently don't support responseRaw, which may be useful
-- for websockets. However, we always read the request body, which
Expand Down

0 comments on commit b0ac85c

Please sign in to comment.