<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -29,10 +29,13 @@ main = do
       else do
           let options = mconcat optionss
           
-          -- Read the page files and the statement they contain
-          pages &lt;- mapM readFile page_paths
+          -- Read the page files and the statement they contain.
+          -- For some reason, the Halifax files contain character 0xA0 (160).
+          -- This terminates the file reading process in text mode for some reason,
+          -- so let's just read in binary mode for now.
+          pages &lt;- mapM readBinaryFile page_paths
           let (account, transactions) = parseStatement pages
-          hPutStrLn stderr (show transactions)
+          --hPutStrLn stderr (show transactions)
           
           -- Read the rules (if any) and apply them to the transactions from the pages
           rules &lt;- maybe (return []) (fmap parseRules . readFile) $ opt_rules_file options
@@ -43,4 +46,9 @@ main = do
                                   QIF    -&gt; outputQIF
                                   Ledger -&gt; outputLedger
                                   CSV    -&gt; outputCSV
-          output_method options account transactions'
\ No newline at end of file
+          output_method options account transactions'
+
+readBinaryFile :: FilePath -&gt; IO String
+readBinaryFile fp = withBinaryFile fp ReadMode $ \h -&gt; do
+    res &lt;- hGetContents h
+    length res `seq` return res</diff>
      <filename>Finance/Halifax/Main.hs</filename>
    </modified>
    <modified>
      <diff>@@ -12,12 +12,12 @@ import Text.HTML.TagSoup
 import Finance.Halifax.Core
 import Finance.Halifax.Utilities
 
-
 parseStatement :: [String] -&gt; (Account, [Transaction])
 parseStatement pages = (parseAccountInfo account_info, transactions)
   where
-    tagss = map parseTags pages
-    account_info = fst $ fragment (~== &quot;&lt;table class=bankingSummaryContainer&gt;&quot;) (~== &quot;&lt;br&gt;&quot;) (head tagss)
+    -- Halifax seems to include stray non-ASCII characters in the files, for some reason (these are the ones that mean we have to read in binary mode).
+    tagss = map (parseTags . map (\c -&gt; if isAscii c then c else ' ')) pages
+    account_info = fst $ fragment (~== &quot;&lt;table class=bankingSummaryContainer&gt;&quot;) (~== &quot;&lt;table class=bankingSummaryInfo&gt;&quot;) (head tagss)
     
     transaction_infoss = map (fst . fragment (~== &quot;&lt;table class=DataTable&gt;&quot;) (~== &quot;&lt;/table&gt;&quot;)) tagss
     transaction_rowss = map (drop 1 . partitions (~== &quot;&lt;tr&gt;&quot;)) transaction_infoss
@@ -30,7 +30,7 @@ parseAccountInfo tags = Account {
         acc_roll_number = get_summary_for &quot;Roll number&quot;
     }
   where
-    get_summary_for = filter (not . isSpace) . fromJust . flip lookup summaries
+    get_summary_for key = filter (not . isSpace) . maybe (error $ &quot;No value for &quot; ++ key) id . flip lookup summaries $ key
     summaries = unfoldr unfold_summary tags
     unfold_summary tags' = case dropWhile (~/= &quot;&lt;td class=summaryBoxesText&gt;&quot;) tags' of
         []     -&gt; Nothing</diff>
      <filename>Finance/Halifax/StatementParser.hs</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cb426d74a971f5a6e5b3c5b0b5eecac26b694618</id>
    </parent>
  </parents>
  <author>
    <name>Max Bolingbroke</name>
    <email>batterseapower@hotmail.com</email>
  </author>
  <url>http://github.com/batterseapower/halifax-import/commit/4cb74d2b89657ec26d65710ef6861c1f419c2790</url>
  <id>4cb74d2b89657ec26d65710ef6861c1f419c2790</id>
  <committed-date>2009-11-01T14:40:17-08:00</committed-date>
  <authored-date>2009-11-01T14:40:17-08:00</authored-date>
  <message>Fix parser on 6.12 - stray non-ASCII in files</message>
  <tree>8e0ed7d78f4a3f7f55b7e5f56a0ce3e55e44c73c</tree>
  <committer>
    <name>Max Bolingbroke</name>
    <email>batterseapower@hotmail.com</email>
  </committer>
</commit>
