Help for this page

Select Code to Download


  1. or download this
      #copy so we don't muck utf8 flag on original string
      my $sTmp=$someData;
      Encode::_utf8_off($sTmp);
      my $iLength = length($sTmp);
    
  2. or download this
    sub countBytes {
     my $s=$_[0];   #makes copy
    ...
    printf "chr=<%s> utf8-flag=%s length=%d bytes=%s\n"
      , $s, Encode::is_utf8($s)?'yes':'no', length($s), $iBytes;
    #outputs: chr=<?> utf8-flag=yes length=1 bytes=2