[Haskell-cafe] The Nature of Char and String
David Roundy
droundy at abridgegame.org
Mon Jan 31 08:08:27 EST 2005
On Sun, Jan 30, 2005 at 07:58:50PM -0600, John Goerzen wrote:
> On Sun, Jan 30, 2005 at 07:39:59PM +0000, Ben Rudiak-Gould wrote:
> > > * If I use hPutStr on a string, is it guaranteed that the number of
> > > 8-bit bytes written equals (length stringWritten)?
> >
> > Yes, if the handle is opened in binary mode. No if not.
>
> Thank you for the informative response.
>
> If a file is opened in text mode, what encoding does Haskell grok on
> input? And what encoding does it generate on output? I'm assuming
> it's UTF-8 on output, but I don't know for sure.
I don't think so, it still just treats the Char as an eight bit C
character, the only difference is that if it's opened as text on windows,
your newlines get mangled. (...or treated properly, depending on your
opinion.)
--
David Roundy
http://www.darcs.net
More information about the Haskell-Cafe
mailing list