diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-03-13 21:19:07 +0000 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2014-03-13 21:19:07 +0000 |
commit | 5bcc09947718bec704ff9561dc193ba3c50a1ccf (patch) | |
tree | ad6047e1d7fb5377d7599e7cacade72dc3589221 /src/Haddock.hs | |
parent | 385db9ab8cec14b21c06632eb1fcbe14ac3c3859 (diff) |
Always read in prologue files as UTF8 (#286).
Diffstat (limited to 'src/Haddock.hs')
-rw-r--r-- | src/Haddock.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Haddock.hs b/src/Haddock.hs index e4c7fdc0..67c45362 100644 --- a/src/Haddock.hs +++ b/src/Haddock.hs @@ -4,7 +4,8 @@ -- | -- Module : Haddock -- Copyright : (c) Simon Marlow 2003-2006, --- David Waern 2006-2010 +-- David Waern 2006-2010, +-- Mateusz Kowalczyk 2014 -- License : BSD-like -- -- Maintainer : haddock@projects.haskell.org @@ -447,10 +448,13 @@ getPrologue dflags flags = case [filename | Flag_Prologue filename <- flags ] of [] -> return Nothing [filename] -> do - str <- readFile filename - case parseParasMaybe dflags str of - Nothing -> throwE $ "failed to parse haddock prologue from file: " ++ filename - Just doc -> return (Just doc) + withFile filename ReadMode $ \h -> do + hSetEncoding h utf8 + str <- hGetContents h + case parseParasMaybe dflags str of + Nothing -> + throwE $ "failed to parse haddock prologue from file: " ++ filename + Just doc -> return (Just doc) _otherwise -> throwE "multiple -p/--prologue options" |