[GHC] #9752: Output unicode characters

#9752: Output unicode characters -------------------------------------+------------------------------------- Reporter: pokiaka | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: unicode, stderr, | Operating System: Windows errors, output, printing, | Type of failure: Incorrect encoding, utf, utf8 | result at runtime Architecture: Unknown/Multiple | Test Case: Difficulty: Easy (less than 1 | Blocking: hour) | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- When using UnicodeHaskell and having an error with a unicode symbol lurking around, GHC fails to print its name. So e.g. you get a message of an error "In the first argument of (<stderr>: commitBuffer: invalid argument (invalid character)". I am not certain, but I think that the fix would be to `hSetEncoding stderr utf8` before the output is printed. If so, hopefully it should be a quick easy fix. (And perhaps it would be appropriate to do the same for stdout as-well, or just when UnicodeSyntax is on). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9752 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9752: Output unicode characters -------------------------------------+------------------------------------- Reporter: pokiaka | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: unicode, stderr, Operating System: Windows | errors, output, printing, encoding, Type of failure: Incorrect | utf, utf8 result at runtime | Architecture: Unknown/Multiple Test Case: | Difficulty: Easy (less than 1 Blocking: | hour) Differential Revisions: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by thomie): Could you add an example please? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9752#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9752: Output unicode characters -------------------------------------+------------------------------------- Reporter: pokiaka | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: unicode, stderr, Operating System: Windows | errors, output, printing, encoding, Type of failure: Incorrect | utf, utf8 result at runtime | Architecture: Unknown/Multiple Test Case: | Difficulty: Easy (less than 1 Blocking: | hour) Differential Revisions: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by pokiaka): Replying to [comment:1 thomie]:
Could you add an example please?
Definitely. Source: {{{ {-# LANGUAGE UnicodeSyntax #-} module Example where (∈) = elem oops = 20 ∈ (10,20,30) }}} Output: {{{ [1 of 1] Compiling Example ( Example.hs, Example.o ) Example.hs:4:13: Couldn't match expected type `[a0]' with actual type `(t0, t1, t2)' In the second argument of `(<stderr>: commitBuffer: invalid argument (invalid character) }}} As you can see, it prints the error where it should have printed `∈`, and then immediately stopped printing, discarding any next messages.<br /> Same behavior on GHCi, and WinGHCi, of course. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9752#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9752: Output unicode characters on Windows -------------------------------------+------------------------------------- Reporter: pokiaka | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: unicode, stderr, Operating System: Windows | errors, output, printing, encoding, Type of failure: Incorrect | utf, utf8 result at runtime | Architecture: Unknown/Multiple Test Case: | Difficulty: Easy (less than 1 Blocking: | hour) Differential Revisions: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Changes (by thomie): * cc: gintas (added) Old description:
When using UnicodeHaskell and having an error with a unicode symbol lurking around, GHC fails to print its name. So e.g. you get a message of an error "In the first argument of (<stderr>: commitBuffer: invalid argument (invalid character)".
I am not certain, but I think that the fix would be to `hSetEncoding stderr utf8` before the output is printed. If so, hopefully it should be a quick easy fix. (And perhaps it would be appropriate to do the same for stdout as-well, or just when UnicodeSyntax is on).
New description: On Windows, when having an error with a unicode symbol lurking around, GHC fails to print its name. So e.g. you get a message of an error "In the first argument of (<stderr>: commitBuffer: invalid argument (invalid character)". I am not certain, but I think that the fix would be to `hSetEncoding stderr utf8` before the output is printed. If so, hopefully it should be a quick easy fix. (And perhaps it would be appropriate to do the same for stdout as-well). -- Comment: Can not reproduce on Linux with GHC 7.8.3, so this seems like a Windows only problem. By the way: you shouldn't need the UnicodeSyntax extension [1] for above example to work/fail. [1] https://www.haskell.org/ghc/docs/latest/html/users_guide/syntax- extns.html -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9752#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9752: Output unicode characters on Windows -------------------------------------+------------------------------------- Reporter: pokiaka | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: duplicate | Keywords: unicode, stderr, Operating System: Windows | errors, output, printing, encoding, Type of failure: Incorrect | utf, utf8 result at runtime | Architecture: Unknown/Multiple Test Case: | Difficulty: Easy (less than 1 Blocking: | hour) Differential Revisions: | Blocked By: | Related Tickets: #6037 -------------------------------------+------------------------------------- Changes (by thomie): * cc: gintas (removed) * status: new => closed * resolution: => duplicate * related: => #6037 Comment: Closing as a duplicate of #6037. Feel free to reopen if you think this is a different bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9752#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC