[Haskell-cafe] invalid character encoding

Simon Marlow simonmar at microsoft.com
Wed Mar 16 04:34:00 EST 2005


On 16 March 2005 03:54, Ian Lynagh wrote:

> 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 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).
> 
> Do you have a list of functions which behave differently in the new
> release to how they did in the previous release?
> (I'm not interested in changes that will affect only whether something
> compiles, not how it behaves given it compiles both before and after).
> 
> Simons, Malcolm, are there any such functions in the new ghc/nhc98?
> 
> Also, are you all agreed that the hugs interpretation of the report is
> correct, and thus ghc at least is buggy in this respect? (I'm afraid I
> haven't been able to test nhc98 yet).

GHC (and nhc98) assumes a locale of ISO8859-1 for I/O.  You could
consider that to be a bug, I suppose.  We don't plan to do anything
about it in the context of the current IO library, at least.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list