Opened 15 months ago

Last modified 3 months ago

#7593 new bug

Unable to print exceptions of unicode identifiers

Reported by: dagit Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:


I suspect this is windows specific but I'm not certain (I couldn't reproduce it with an older ghc on osx).

Here is an example of the problem:

GHCi, version 7.6.1:  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude λ> ⇒

<interactive>:2:1: parse error on input `*** Exception: <stderr>: hPutChar: invalid argument (invalid character)

On other platforms the message looks more like: parse error on input `=>'

(not the automatic translation from ⇒ to =>, I think that's a separate bug related to the unicode symbols extension)

On windows my ghc is version 7.6.1. On OSX (where I could NOT reproduce the exception), my ghc is 7.4.1. I don't know if the GHC version matters. I strongly suspect this is a windows unicode issue.

GHC gives similar behavior to ghci, for example on this input:

⇒ = 1

ghc tries to give an error message but throws an exception printing ⇒.

Change History (4)

comment:1 Changed 15 months ago by dagit

Changing to the codepage to 65001 before compiling the file gets rid of the exception, but the error message still looks a bit off:

Foo.hs:1:1: parse error on input `⇒��'

comment:2 Changed 12 months ago by igloo

  • Difficulty set to Unknown
  • Milestone set to 7.8.1

Thanks for the report. We'll take a look.

comment:3 Changed 6 months ago by nomeata

Just FTR: It works with 7.6.1 on Linux, so the Windows attribute seems to be correct.

comment:4 Changed 3 months ago by huzhe

I believe this is the same issue as this:

Prelude> putStrLn "я"
*** Exception: <stdout>: hPutChar: invalid argument (invalid character)

This doesn't happen with Latin-1 characters like "è" on my machine (codepage dependency?)

Note: See TracTickets for help on using tickets.