unicode - How to replace characters in a file utf8 in perl? -
i have (it works):
perl -c -mtext::unidecode -n -i -e'print unidecode( $_)' unicode_text.txt and want same in script:
#!/usr/bin/perl -w -csa use utf8; use text::unidecode; while(<>) { print unidecode($_); } but doesn't work.
you should have got error message
too late "-csa" option which makes program read input file utf-8-encoded.
instead need put
use open qw( :std :utf8 ); before while loop, same -cs on command line, i.e. set stdin, stdout , stderr handles utf-8 encoding
Comments
Post a Comment