Skip to content

windows unicode problem with cabal list #846

Closed
bos opened this Issue May 24, 2012 · 5 comments

2 participants

@bos
Haskell member
bos commented May 24, 2012

(Imported from Trac #856, reported by guest on 2011-06-18)

C:>cabal list dedukti

  • dedukti
Synopsis: A type-checker for the cabal.EXE: <stdout>: invalid argument

http://hackage.haskell.org/packages/archive/dedukti/1.1.4/dedukti.cabal

"A type-checker for the λΠ-modulo calculus."

@bos
Haskell member
bos commented May 24, 2012

(Imported comment by @dcoutts on 2011-06-18)

Hmm, apparently the default locale on Windows is not Unicode capable. That seems odd actually.

We'll need to take this up with the ghc devs.

@bos
Haskell member
bos commented May 24, 2012

(Imported comment by @batterseapower on 2011-06-18)

The default console locale on Windows is CP850 which is most certainly not a Unicode superset. Try running "cabal list" from e.g. Cygwin's Mintty in a Unicode locale and you should get the right output.

Perhaps we could change the default CodingFailureMode? used to write to std{out,err} to TransliterateCodingFailure?, which would replace the invalid characters with "?". I'm just concerned that this might not be the right thing to do for all Haskell programs.

@bos
Haskell member
bos commented May 24, 2012

(Imported comment by @dcoutts on 2011-06-19)

Ah ok, so perhaps we should just set that on stdout for the appropriate cabal commands. Have to think about what to do for --simple-output and similar flags designed for machine readable output. Tricky thing is that if they're consumed by a program or directed to a file then we almost certainly want utf8. If it's printed to the screen then we want the locale encoding and the forgiving ??? conversion mode.

So ideally we'd just set this once in main in cabal & Setup.hs and have the machine readable output commands do something special.

@bos
Haskell member
bos commented May 24, 2012

(Imported comment by @kosmikus on 2011-06-20)

Also see #885.

@ianbollinger

I'm not sure anything special needs to be done for --simple-output. File redirection still fails if the console code page isn't set to UTF-8. Using System.Process.readProcess on Cabal seems to work fine with the proposed changes. We could also check to see if the current locale encoding isn't already UTF-8 before relaxing the error handling.

Unfortunately, doing this uncovers another bug, when Cabal tries to write a Unicode-character-containing-path to the config file using the locale encoding and fails.

@23Skidoo 23Skidoo closed this in #1743 Apr 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.