[GHC] #9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM)

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 7.10.1-rc1 Keywords: | Operating System: Windows Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- Trying to compile a file that starts with a Byte Order Mark (BOM) results in the message like: Camels.hs:1:1: lexical error at character '\65279' No compilation is done. Note that, if a file is saved as UTF-8, Notepad adds this BOM to the beginning of the file. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: feature request | Status: new Priority: high | Milestone: Component: Compiler | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by hvr): * type: bug => feature request Comment: This is definitely not a bug on GHC's part, but rather on Notepad's. BOMs cause many problems when used in UTF8 and are highly discouraged, so it should come to no surprise that GHC complains about it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by hvr): * priority: high => low -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Henk-Jan): When I remove the BOM by saving the file in ANSI coding (using Notepad), I get the following message from GHC: Camels.hs:152:56: lexical error in string/character literal (UTF-8 decoding error) This is because of an o-umlaut in the comments. The file can be found at: https://raw.githubusercontent.com/wxHaskell/wxHaskell/master/samples/contrib... (Geany states that the file is in CP1252 code and displays it correctly) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by hvr): Currently, GHC's lexer assumes its input to be ASCII or UTF8 (for which a BOM is rather pointless -- as an UTF8 stream doesn't allow for different byteorders). The CP1252 (same with ISO-8859-1 btw) encoding, however, is only compatible for the lowest 128 code-points. I believe the usual recommendation is to use Notepad++ which allows to write UTF8 w/o that gratuitous BOM. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: feature request | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 7.10.1-rc1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by hvr): * milestone: => ⊥ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9987: GHC refuses to compile a file that starts with a Byte Order Mark (BOM) -------------------------------------+------------------------------------- Reporter: Henk-Jan | Owner: Type: feature request | Status: closed Priority: low | Milestone: ⊥ Component: Compiler | Version: 7.10.1-rc1 Resolution: duplicate | Keywords: Operating System: Windows | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #6016 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => duplicate * related: => #6016 Comment: I am bringing you good news from #6016. A fix for BOMs in Haskell source files will be in 7.10. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9987#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC