724526e05c
caused by some feeds: set binary mode on the handle before hGetContents (upstream git commit bd08d07cc29893177efe8ef0e8be368657d56bbf)
27 lines
877 B
Plaintext
27 lines
877 B
Plaintext
$OpenBSD: patch-FeedParser_hs,v 1.4 2012/03/20 13:33:54 dcoppa Exp $
|
|
|
|
Fix the "Invalid or incomplete multibyte or wide character" error
|
|
caused by some feeds: set binary mode on the handle before hGetContents
|
|
(upstream git commit bd08d07cc29893177efe8ef0e8be368657d56bbf)
|
|
|
|
--- FeedParser.hs.orig Tue Nov 8 16:49:38 2011
|
|
+++ FeedParser.hs Tue Mar 20 14:08:25 2012
|
|
@@ -39,6 +39,7 @@ import Data.Maybe.Utils
|
|
import Data.Char
|
|
import Data.Either.Utils
|
|
import Data.List
|
|
+import System.IO
|
|
|
|
data Item = Item {itemtitle :: String,
|
|
itemguid :: Maybe String,
|
|
@@ -68,7 +69,8 @@ item2ep pc item =
|
|
|
|
parse :: FilePath -> String -> IO (Either String Feed)
|
|
parse fp name =
|
|
- do c <- readFile fp
|
|
+ do h <- openBinaryFile fp ReadMode
|
|
+ c <- hGetContents h
|
|
case xmlParse' name (unifrob c) of
|
|
Left x -> return (Left x)
|
|
Right y ->
|