Don't assume this. :-)
Perl 5.8.0 will "honor" your TERM environment variable and may use UTF-8 for IO if your terminal is UTF-8.
For the original problem: Use :bytes when opening the IO channel and treat the content as bytes. If, and only if, you need to work with some Unicode (or UTF-8 or whatever codepage) text convert a substring of it. So the scalar will be marked as containing bytes and substr will work on 8 bit wide characters == bytes. If you let Perl decide if the stream is bytes or UTF-8 it will fail (die/warn/data corruption) if Perl decides for UTF-8 and gets a JPG image...
In reply to Re: Re: Re: Re: How do I safely, portably extract one or more bytes from a string?
by Beechbone
in thread How do I safely, portably extract one or more bytes from a string?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |