Skip to content

On Windows, runhaskell hits an error on UTF-8 files with a BOM

The file

{{{ #!/usr/bin/env runhaskell main = putStrLn "Hello, world!" }}} works as expected:

C:\Temp>runhaskell hello.hs
Hello, world!

However, if the file is saved as UTF-8 with a BOM (Windows Notepad, for example, sometimes adds this BOM to files), an error occurs:

C:\Temp>runhaskell hello2.hs

hello2.hs:1:1: parse error on input `#!/'

I'm using the Haskell Platform 2011.4.0.0.

I believe that runhaskell/runghc should handle the presence of a BOM correctly; some Windows programs insert a BOM unbeknownst to the user.

This behaviour was observed on Windows XP (32-bit) and Windows 7 (32-bit and 64-bit).

Edited by Thomas Miedema
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information