[Haskell-cafe] invalid character encoding
jgoerzen at complete.org
Tue Mar 15 09:12:48 EST 2005
On Tue, Mar 15, 2005 at 10:44:28AM +0000, Ross Paterson wrote:
> On Mon, Mar 14, 2005 at 07:38:09PM -0600, John Goerzen wrote:
> > I've got some gzip (and Ian Lynagh's Inflate) code that breaks under
> > the new hugs with:
> > <handle>: IO.getContents: protocol error (invalid character encoding)
> > What is going on, and how can I fix it?
> A Haskell 98 Handle is a character stream, and doesn't support binary
> I/O. This would have bitten you sooner or later on systems that do CRLF
Yes, probably so..
> conversion, but Hugs is now much stricter, because character streams now
> use the encoding determined by the current locale (for the C locale, that
> means ASCII only).
Hmm, this seems to be completely undocumented. So yes, I'll try using
openBinaryFile, but the docs I have seen still talk only about CRLF and
Anyway, I'm intrested in this new feature (I assume GHC 6.4 has it as
well?) Would it, for instance, automatically convert from Latin-1 to
UTF-16 on read, and the inverse on write? Or to/from UTF-8?
More information about the Haskell-Cafe