I am trying to use Text::Iconv module and not able to get desired results .
Here is a code snippet
use strict;
use Text::Iconv;
my $converter = Text::Iconv->new('UTF-8','UTF-8');
my @str = ('galicia','a coruñaa',,'a coruñaa',,'baĂCĂE kasĂCĂD nĂCĂ
+D n msn ĂCĂE ifresini');
push (@str ,' galicia a coru�a ');
foreach my $q (@str){
my $result = $converter->convert($q);
print "$q ==> $result \n";
}
Result:-
galicia ==> galicia
a coruñaa ==> a coruñaa
a coruñaa ==> a coruñaa
baĂCĂE kasĂCĂD nĂCĂD n msn ĂCĂE ifresini ==> baĂCĂE kasĂCĂD nĂCĂD n
+msn ĂCĂE ifresini
galicia a coru�a ==> galicia a coru�a
where as if i use the cmd line option
iconv -c -f UTF-8 -t UTF-8 -o resultfile originalfile
Eg:- diff resultfile originalfile
a corua a coru�a
Can you please let me know where i am going wrong.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.