[Haskell-cafe] How does GHC avoid "<stderr>: hPutChar: invalid argument (invalid character)"?

Yuji Yamamoto whosekiteneverfly at gmail.com
Tue Apr 11 13:22:13 UTC 2017

Brandon and Merijn,

Thank you for advice.
But I should have noted that the issue is about Windows...
So things to take care might be different...

2017-04-11 16:46 GMT+09:00 Merijn Verstraaten <merijn at inconsistent.nl>:

> This sounds to me like a classical case of a wrongly (or not) configured
> locale/terminal. As a starting point I would check both what the locale
> variables are set to (run "locale" in the shell) and check what encoding
> the terminal is set to. I've noticed a lot of linux installs have
> completely borked configuration with regards to these and in those cases
> GHC can't do much.
> Side note: Just forcing output to be utf8 is *definitely* the wrong thing
> to do, as it'd break any environment set to a different encoding...
> Cheers,
> Merijn
> > On 11 Apr 2017, at 1:24, Yuji Yamamoto <whosekiteneverfly at gmail.com>
> wrote:
> >
> > Hello Haskellers,
> >
> > Currently, I’m working on this issue,
> > where haddock crashes when printing the Unicode “bullet character” on
> stderr whose character encoding is not UTF-8.
> >
> > In the beforementioned pull request, I just added hSetEncoding stderr
> utf8 as a quick-and-dirty workaround.
> > But GHC actually doesn’t do so: GHC prints “?” instead of the bullet
> character when stderr is not Unicode-compatible.
> >
> > So, I believe there’s a better way to handle the case, and GHC knows it.
> > Then, how does GHC detect the handle’s character encoding and convert
> incompatible characters (such as the bullet character) into “?” to avoid
> the error?
> > I couldn’t get it by reading the source of GHC a bit.
> >
> > Thanks in advance!
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > To (un)subscribe, modify options or view archives go to:
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> > Only members subscribed via the mailman list are allowed to post.

twitter: @igrep
GitHub: https://github.com/igrep
Facebook: http://www.facebook.com/igrep
Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170411/199a93ec/attachment.html>

More information about the Haskell-Cafe mailing list