
#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