Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1057

perl script to check 2 byte unicode is not working

$
0
0

My perl script is not finding the unicode character in the name below.

Helen Mon‘ea

When i viewed the above name in UTF-8, it shows as x91

#!/usr/bin/perluse warnings;## purpose: Identify line numbers containing the 2-byte unicode characters## use perl argv to verify the number of command line arguments@ARGV >= 2 or die "Usage: \n======\n\tperl $0  <Accepted Record Length> <File-Name> For example,     perl /opt/apps/scripts/IdentUnicodChar.pl 576 <Actual File Name>\n";$RECL = $ARGV[0];$filename = $ARGV[1];if ( @ARGV == 3){  $Flag_Print= $ARGV[2];} else{  $Flag_Print= "NoPrint";}open(FILE, $filename) or die "Could not read from $filename, program halting.";$count = 1;$First = Y;while (<FILE>){#  print "$First .";if (length($_) != $RECL){  if ( $Flag_Print eq 'print' )      {         print $_;     print "\n--------------------------- \n";      }    if ( $First eq 'Y' )    {       $First = N;      print $.;    } else    {      print ", ";      print $.;    }} $count++;}close FILE;print "\n";

I tried using the below and binmode(STDOUT, ":encoding(UTF-8)"); but it is not helping or detecting this unicode character

use utf8;


Viewing all articles
Browse latest Browse all 1057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>