-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
λ> let bø = [fmt|ø|] :: ByteString; in T.putStrLn $ "ø vs " <> [fmt|{T.decodeUtf8With T.lenientDecode bø}|]
ø vs �
λ> ([fmt|ø|]:: ByteString, T.encodeUtf8 "ø")
("\248","\195\184")
λ> ([fmt|{T.pack "ø"}|]:: ByteString, T.encodeUtf8 "ø")
("\248","\195\184")
("ø" in UTF-8 is 0xC3 0xB8 which is 195 184)
Does fmt encode bytestrings using some other encoding?
My current workaround is to restrict it to text
{-# LANGUAGE TemplateHaskell #-}
module PyF.Foo where
import Language.Haskell.TH.Quote
import Data.Text qualified as T
import PyF
import PyF.Internal.QQ (Config (..))
t :: QuasiQuoter
t =
mkFormatter
"t"
( fmtConfig
{ postProcess = \e -> [|T.pack $(e)|]
}
)
Metadata
Metadata
Assignees
Labels
No labels