- or download this
$ perl -e 'print substr("a\x{2322}bcd", 0, 3), "\n";' | hexdump
00000000 61 e2 8c a2 62 0a
- or download this
$ perl -e 'print "a\x{2322}bcd\n"' > uni-file
$ perl -ne 'print substr($_,0,3), "\n"' uni-file | hexdump
00000000 61 e2 8c 0a
- or download this
$ perl -ne 'utf8::upgrade($_);
> print substr($_,0,3), "\n"' uni-file |
> hexdump
00000000 61 e2 8c 0a
- or download this
$ perl -ne 'BEGIN{binmode(STDIN,":utf8");
> print substr($_,0,3), "\n"' uni-file |
> hexdump
00000000 61 e2 8c a2 62 0a
- or download this
$io->open($in_file, "<:raw:encoding(cp1252)") || die(...);
- or download this
while (!$io->eof) {
$cols = $csvin->getline($io);
...
$str = $col[0];
print substr($str,0,3), "\n"; # XXX cuts through utf8 multibyte!
}