--- /dev/null
+module Misc
+where
+
+import qualified Data.ByteString.Lazy as B (ByteString, readFile)
+import System.Directory (getTemporaryDirectory, removeFile)
+import System.IO (hClose, hPutStr, hSetEncoding, openTempFile, utf8)
+
+-- | Run a 'String' through the filesystem to convert it to a
+-- 'ByteString' in the stupidest way possible.
+string_to_bytestring :: String -> IO B.ByteString
+string_to_bytestring s = do
+ dir <- getTemporaryDirectory
+ (path, h) <- openTempFile dir "nu1Uideehe"
+ hSetEncoding h utf8
+ hPutStr h s
+ hClose h
+ result <- B.readFile path
+ removeFile path
+ return result