A peer-to-peer stack for code collaboration
Always read radicle code as UTF-8
Thomas Scholtesf19987df8ccc
diff --git a/exe/RadicleExe.hs b/exe/RadicleExe.hsindex 1568b08..ecf33fd 100644--- a/exe/RadicleExe.hs+++ b/exe/RadicleExe.hs@@ -3,6 +3,7 @@ module RadicleExe (main) whereimport Prelude (String)import Protolude hiding (TypeError, option, sourceFile)+import qualified Data.ByteString as BSimport Options.Applicativeimport System.Directory (doesFileExist)@@ -17,7 +18,7 @@ main = docode <-if sourceFile opts' == "-"then do- src <- getContents+ src <- decodeUtf8With lenientDecode <$> BS.getContentslet prog = interpretMany "[stdin]" srcbindings <- createBindings (toS <$> scriptArgs opts')(result, _state) <- runLang bindings prog@@ -45,10 +46,10 @@ main = doreadSource :: String -> IO TextreadSource file = do- exists <- doesFileExist file- if exists- then readFile file- else die $ "Could not find file: " <> toS file+ exists <- doesFileExist file+ if exists+ then decodeUtf8With lenientDecode <$> BS.readFile file+ else die $ "Could not find file: " <> toS fileradDesc :: StringradDescdiff --git a/package.yaml b/package.yamlindex 6351fd0..44d4d4d 100644--- a/package.yaml+++ b/package.yaml@@ -89,6 +89,7 @@ executables:other-modules: []dependencies:- radicle+ - bytestring- directory- optparse-applicativewhen:diff --git a/src/Radicle/Internal/Effects/Capabilities.hs b/src/Radicle/Internal/Effects/Capabilities.hsindex 42574d7..0de02bf 100644--- a/src/Radicle/Internal/Effects/Capabilities.hs+++ b/src/Radicle/Internal/Effects/Capabilities.hs@@ -7,6 +7,7 @@ module Radicle.Internal.Effects.Capabilities whereimport Protolude+import qualified Data.ByteString as BSimport Data.Text.Prettyprint.Doc (PageWidth)import Data.Timeimport System.Console.ANSI (hSupportsANSI)@@ -149,7 +150,7 @@ instance ReadFile (InputT IO) whereinstance ReadFile (InputT IO) wherereadFileS = lift . readFileSinstance ReadFile IO where- readFileS fname = (Right <$> readFile (toS fname))+ readFileS fname = (Right . decodeUtf8With lenientDecode <$> BS.readFile (toS fname))`catch` (\(e :: IOException) -> pure (Left (show e)))#endifinstance {-# OVERLAPPABLE #-} ReadFile m => ReadFile (Lang m) where