Proposal #3337: expose Unicode and newline translation from System.IO

Simon Marlow marlowsd at gmail.com
Tue Jun 30 10:29:55 EDT 2009


On 30/06/2009 14:10, Ross Paterson wrote:
> This patch increases the need to make binary Handles a different type.

It does indeed.  That's something for another proposal, though.

> When you set the TextEncoding of an output Handle to utf16 or utf32,
> does that trigger output of a BOM?

No, but the BOM will be output as part of the first writing operation.

> When you set the TextEncoding of an input Handle to utf16 or utf32,
> does it immediately read a character looking for a BOM?

No, but it looks for a BOM when the first batch of bytes is decoded, 
which will happen the first time you read from the Handle.

> Do you really need two Newline modes per Handle?  Most Handles are
> unidirectional, and even a ReadWrite Handle is reading and writing
> to the same file.  The main benefit seems to be that you can apply
> universalNewlineMode to any Handle, but is that worth the complication?

There are also bidirectional Sockets.  But I take your point; 
universalNewlineMode is indeed the main reason we have separate 
input/output modes.

I wouldn't have any objection to simplifying it, if people don't think 
the extra complication is worthwhile.

Cheers,
	Simon



More information about the Libraries mailing list