in reply to UTF-8 and systemIO are not friends anymore

I don't see any problems with your presented statement.

I was rather shocked when I stumbled across the new sysread behavior for UTF-8 streams. It seems rather nonsensical to me, demonstrating a lack of understanding or appreciation of several of the reasons why Perl even has sysread().

One not-yet-published module of mine notes:

At least in some versions of Perl, if a file handle has the ":utf8" encoding layer in place [such as via binmode()], then sysread() does some weird and unfortunate things under the covers beyond just calling the read(2) system call once. This makes 4-argument select() incompatible with sysread() for those versions of Perl (when the ":utf8" layer is used).

[....]

You should probably avoid the ":utf8" layer for file handles you wish to use with 4-argument select().

- tye        

Replies are listed 'Best First'.
Re^2: UTF-8 and systemIO are not friends anymore (unfortunate)
by Anonymous Monk on Dec 31, 2015 at 01:12 UTC
    t seems rather nonsensical to me
    Why? Perl's sysread:
    sysread FILEHANDLE,SCALAR,LENGTH,OFFSET
    (my system's) pread:
    ssize_t pread(int fd, void *buf, size_t count, off_t offset);
    How can it work with anything other than bytes and still call itself sys-something? (even if Perl's pread is actually lseek and read... that doesn't change much wrt utf-8)
      LOL! Shows how much I use sysread... But anyway, the argument about seek stands. But sorry! :)