in reply to Encoding question
use Encode qw( decode ); my $bytes = "x\0m\0l\0"; print(length($bytes), "\n"); # 6 my $chars = decode('utf16le', $bytes); print(length($chars), "\n"); # 3 print($chars =~ /xml/ ?1:0,"\n"); # 1
Update: Oops, I had utf8 instead of utf16le originally. utf16 will also work with the original string since it contained a BOM.
|
---|