Help for this page

Select Code to Download


  1. or download this
      if ( /[^\x00-\x7f]/ ) # true if $_ contains any non-ascii character
    
  2. or download this
    use Encode;
    
    ...
    if ( $@ ) {
       # Encode would fail/die if $_ was not a valid utf8 string
    }
    
  3. or download this
    my @bytes = unpack( "C*", $_ ); # break string into bytes
    
    ...
    die "Incomplete multibyte char\n" if ( $width );
    
    # get here if the string was valid utf8