diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | src/Haddock.hs | 14 |
2 files changed, 13 insertions, 5 deletions
@@ -1,3 +1,7 @@ +Changes in version 2.15.0 + + * Always read in prologue files as UTF8 (#286 and Cabal #1721) + Changes in version 2.14.1 * Render * and -> with their UnicodeSyntax equivalents if -U is enabled 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" |