diff options
| author | Albert Krewinkel <[email protected]> | 2022-06-19 14:25:24 +0200 |
|---|---|---|
| committer | Albert Krewinkel <[email protected]> | 2022-06-19 14:33:33 +0200 |
| commit | f39eeba35f85b46b80c73c6341c099a21caa38d5 (patch) | |
| tree | a9e288470d9d66f68d1b30b77ae3e584c4a1e60d /src | |
| parent | 0f573a5368e82f336d95ca335e29a047457bf081 (diff) | |
Lua: do not reset foreign encoding before running Lua
This was a leftover from previous hslua versions that relied heavily on
`Foreign.C.withCString` and the like. However, hslua 2 and later use
bytestring functions to retrieve string values, so this is no longer
needed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Lua/Init.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Lua/Init.hs b/src/Text/Pandoc/Lua/Init.hs index 78ba02713..ab03296ad 100644 --- a/src/Text/Pandoc/Lua/Init.hs +++ b/src/Text/Pandoc/Lua/Init.hs @@ -19,7 +19,6 @@ import Control.Monad.Catch (throwM, try) import Control.Monad.Trans (MonadIO (..)) import Data.Maybe (catMaybes) import HsLua as Lua hiding (status, try) -import GHC.IO.Encoding (getForeignEncoding, setForeignEncoding, utf8) import Text.Pandoc.Class.PandocMonad (PandocMonad, readDataFile) import Text.Pandoc.Error (PandocError (PandocLuaError)) import Text.Pandoc.Lua.Marshal.List (pushListModule) @@ -41,13 +40,10 @@ import qualified Text.Pandoc.Lua.Module.Utils as Pandoc.Utils -- initialization. runLua :: (PandocMonad m, MonadIO m) => LuaE PandocError a -> m (Either PandocError a) -runLua luaOp = do - enc <- liftIO $ getForeignEncoding <* setForeignEncoding utf8 - res <- runPandocLua . try $ do +runLua action = + runPandocLua . try $ do initLuaState - liftPandocLua luaOp - liftIO $ setForeignEncoding enc - return res + liftPandocLua action -- | Modules that are loaded at startup and assigned to fields in the -- pandoc module. |
