[GHC] #10889: Compiled software can not read UTF-8 characters using readFile when run via Upstart

GHC ghc-devs at haskell.org
Wed Sep 16 16:17:26 UTC 2015


#10889: Compiled software can not read UTF-8 characters using readFile when run via
Upstart
-------------------------------------+-------------------------------------
        Reporter:  SiXoS             |                   Owner:
            Type:  bug               |                  Status:  closed
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.2
      Resolution:  invalid           |                Keywords:
Operating System:  Linux             |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Runtime crash     |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by nomeata):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 This is expected. I assume that under upstart, programs are run without a
 locale being set, so your Haskell program does not know what encoding to
 use when reading that file, defaults to (I believe)  `ascii` and fails to
 decode your file.

 There are basically two solution:
  * Change the upstart script to set a locale (e.g. `LANG=C.utf-8`).
  * Change the program to explicitly set the encoding you want it to use
 (see `hSetEncoding` in `System.IO`)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10889#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list