http://qs321.pair.com?node_id=1186935


in reply to Read (sysread) binary data into utf8 string

Asa a side note, if you want to switch the storage format of a scalar, best to use bultins utf8::upgrade($s); (switch to UTF8=1 format) or utf8::downgrade($s); (switch to UTF8=0 format) rather than _utf8_on and _utf8_off (which requires extra work to avoid creating bad scalars).

utf8::upgrade( my $s1 = ' ' );