H98 Text IO

Simon Marlow simonmarhaskell at gmail.com
Tue Feb 26 09:18:17 EST 2008

Simon Marlow wrote:
> Duncan Coutts wrote:

Let's call this one proposal 0:

>>       * Haskell98 file IO should always use UTF-8.
>>       * Haskell98 IO to terminals should use the current locale
>>         encoding.

and the others:

>   1. all text I/O is in the locale encoding (what C and Hugs do)
>   2. stdin/stdout/stderr and terminals are always in the locale
>      encoding, everything else is UTF-8
>   3. everything is UTF-8

Some other points that came up on IRC:

  - there's a long precedent for behaving differently when connected to
    a terminal.  For example, 'ls' formats output in columns when
    connected to a terminal, or displays output in colour.  This is
    a point in favour of (0).

  - we might expect that "prog file" behaves the same as "prog <file",
    which would rule out (2).

  - (3) doesn't actually make "prog | cat" do the right thing if your
    locale is not UTF-8, it just makes "prog | cat" the same as "prog"
    alone (i.e. consistently wrong, which is perhaps better than
    inconsistently wrong).


More information about the Glasgow-haskell-users mailing list