From b0ac85cacfa4308e77a23ce14d519af9910d5eae Mon Sep 17 00:00:00 2001 From: Fumiaki Kinoshita Date: Sun, 15 Oct 2023 16:19:55 +0900 Subject: [PATCH] Use official decodeUtf8Lenient from text >= 2.0 --- Web/Scotty/Util.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Web/Scotty/Util.hs b/Web/Scotty/Util.hs index 69766509..6e600c4d 100644 --- a/Web/Scotty/Util.hs +++ b/Web/Scotty/Util.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} module Web.Scotty.Util ( lazyTextToStrictByteString @@ -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