in reply to Re^2: Read and write UTF-8
in thread Read and write UTF-8

If you want to extract a given number of bytes from a UTF-8 string, use bytes::substr :
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use open IO => ':encoding(UTF-8)', ':std'; my $string = join q(), map chr, 9312 .. 9321; say $string; say substr $string, 0, 7; say bytes::substr $string, 0, 7;

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,