[GHC] #6016: On Windows, runhaskell hits an error on UTF-8 files with a BOM

GHC ghc-devs at haskell.org
Sun Jul 20 20:51:05 UTC 2014


#6016: On Windows, runhaskell hits an error on UTF-8 files with a BOM
-------------------------------------+-------------------------------------
              Reporter:  vsajip      |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:  7.10.1
             Component:  Compiler    |           Version:  7.0.4
  (Parser)                           |          Keywords:  BOM
            Resolution:              |  Operating System:  Unknown/Multiple
Differential Revisions:              |   Type of failure:  GHC rejects
          Architecture:              |  valid program
  Unknown/Multiple                   |         Test Case:
            Difficulty:  Unknown     |          Blocking:
            Blocked By:              |
       Related Tickets:  #1744       |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * os:  Windows => Unknown/Multiple
 * related:   => #1744


Old description:

> The file
>
> {{{
> #!/usr/bin/env runhaskell
> main = putStrLn "Hello, world!"
> }}}
> works on Windows 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).

New description:

 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).

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/6016#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list