binmode STDOUT, ":utf8"; # eliminates "Wide character in print" error in Czech use open ":encoding(utf8)"; # otherwise utf8 in input files is read as if 1 character==1 byte # The combination of two lines above is needed in order to get the following to work: # - Czech characters coded into the source print without the "Wide character in print" error. # - Accented characters and Greek characters in the input file are read properly and printed back out properly. # When testing this, make sure to use a terminal such as mlterm that can handle accented characters, # and make sure that the --nofilter_accents_on_output has not been set automatically based on the # value of the $TERM variable. (Using mlterm prevents this.) # See "man perlunicode". # An example of the confusing way all of this works: # perl -e 'binmode STDOUT,":utf8"; print "\x{11b}\x{e9}"' # perl -e 'binmode STDOUT,":utf8"; print "\x{11b}\x{e9}"' >a.a # perl -e 'binmode STDOUT,":utf8"; open(F,"; close F; print $x' # perl -e 'binmode STDOUT,":utf8"; open(F,"; close F; print length $x' # perl -e 'use open ":encoding(utf8)"; binmode STDOUT,":utf8"; open(F,"; close F; print $x' # perl -e 'use open ":encoding(utf8)"; binmode STDOUT,":utf8"; open(F,"; close F; print length $x' use utf8; # Indicates that source can contain utf8, which we use for the Greek translation. use locale;