Kinda new to Perl. I am using Perl web API to get the data. The error is "application/xml; charset=UTF-8". I used 'use utf8' but doesn't seem to work. The line it gets stuck looks something like this
my @candidates = $c->bookmarks_for(start => 1, tag =>'pubmed');
Can you please help me.
Thank you, Sammed
The
use utf8;
is only (and only) for one thing. When you will use in your source code utf8 characters. For example:
my $utf8str = "αΩ";
For any other thins, for example:
my $data = MyModule::get_some_data();
you should use
my $utf8data = Encode::decode_utf8($data);
In the case, when your get_some_data returning octets (bytes).
For example, when reading text files, you can tell perl utf8 conversion at IO level with,
open($fd, "<", $filename);
$fd->binmode(:utf8); #for marking data as utf8, or
$fd->binmode(:encoding(utf8)); #for marking *and* checking data for utf8 validity too.
Or you can use the open pragma for telling perl using utf8 as default at IO layer
use open(:std :utf8);
Here is no short answer. You really should read:
Perl is extremely strong in utf8 processing, but you must know, hot to use it properly - unfortunately, here is no shorter way as RTFM...
And note: here are differences in utf8 processing in perl <5.6, 5.6, 5.8, 5.12, 5.14...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With