Luke Plant committed 01f2f75

Fixed migration routine to decode UTF8 into strings

Comments (0)

Files changed (1)

 import qualified Blog.Post as P
 import qualified Blog.Links as Links
 import qualified Blog.Settings as Settings
-import qualified Data.ByteString.Char8 as B
+import qualified Data.ByteString.Char8 as BS
+import qualified Data.ByteString.Lazy.Char8 as BL
 import qualified Data.ByteString.Lazy.UTF8 as UTF8
 import qualified Data.Map as Map
 -- Migration script for the old data
                              let fixed = fixCodes f
                              return p { P.post_raw = fixed,
                                         P.post_formatted = fixed }
-          fixCodes txt = B.unpack $ regexReplace (B.pack "
") (B.pack "\n") (B.pack txt)
+          -- Fix dodgy stuff, and reinterpret as UTF8
+          fixCodes txt = UTF8.toString $ BL.pack $ BS.unpack $ regexReplace (BS.pack "
") (BS.pack "\n") (BS.pack txt)
 readPostCategories = makeItems "postcategories.txt" mkPostCategory
     where mkPostCategory row = (read (row !! 0),