[GHC] #10477: Tab-completing in a directory with Unicode heiroglyph crashes ghci

#10477: Tab-completing in a directory with Unicode heiroglyph crashes ghci -------------------------------------------+------------------------------- Reporter: acfoltzer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.1 Keywords: | Operating System: Windows Architecture: Unknown/Multiple | Type of failure: GHCi crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------------+------------------------------- With a file called ð“…–.hs in `C:\Users\acfoltzer`, the following in `cmd.exe`: {{{ C:\Users\acfoltzer>chcp 65001 Active code page: 65001 C:\Users\acfoltzer>ghci GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help Prelude> :l C:\cygwin\home\acfoltzer\<TAB> ghc.exe: panic! (the 'impossible' happened) (GHC version 7.10.1 for i386-unknown-mingw32): Enum.toEnum{Word16}: tag (78166) is outside of bounds (0,65535) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} Here, I'm setting the code page first according to the various bits of folk wisdom on the Internet about getting Unicode to properly display in `cmd.exe`. I don't get this crash with a Cygwin terminal, but rather see `??.hs`. I came across this because I was getting the same exception in the Cryptol REPL, so I suspect it's not unique to GHCi, but is rather something fishy in base. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10477 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10477: Tab-completing in a directory with Unicode heiroglyph crashes ghci -------------------------------+------------------------------------------- Reporter: acfoltzer | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------+------------------------------------------- Comment (by AlexET): This specific problem comes from haskeline. It uses `map (toEnum . fromEnum)` to convert a `String` to a list of `Word16` before printing the string. This fails in this case of wider characters which need to be encoded with a surrogate pair. There is a six year old ticket here http://trac.haskell.org/haskeline/ticket/63. The bad news is that printing using the functions in the prelude has even worse unicode support on windows. It seems to print garbage (this includes for the unicode quotes in compiler error messages). If we are in the standard code page we just get errors (as expected). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10477#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC