
1 Feb
2008
1 Feb
'08
12:30 p.m.
Ketil Malde wrote:
But how about a 'withDefaultEncoding' modifier that inspects the first two (or four?) bytes for a Unicode BOM, and either sets decoding accordingly and continues, or sets encoding according to locale *and* lets the user read the first bytes when reading from the handle.
I really don't like the idea of gluing notions of encoding and decoding to Handles, because Handles are so limited in their usefulness. Even something as simple as reading an encrypted file defeats this approach. Never mind stream sockets, datagram sockets, memory mapped files, or any of a dozen other ways of getting data that will have an encoding.