use strict; use warnings; main(); sub main { my $test = "\x{0414}"; # unicode cyrillic "capital letter de" printf( "character length: %d\n", length( $test )); check_string( $test, 1 ); # this call causes "Wide character in print" warning, but output is ok utf8::encode( $test ); printf( "byte length: %d\n", length( $test )); check_string( $test, 2 ); # no warning from this call } sub check_string { my ( $str, $num ) = @_; my $status = ( utf8::is_utf8( $str )) ? 'utf8' : 'not utf8'; printf( " %d -- check_string: input %s is %s\n", $num, $str, $status ); }