Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: UTF8 support for CSV, PDF formats

by Eliya (Vicar)
on Jan 06, 2012 at 14:11 UTC ( #946601=note: print w/ replies, xml ) Need Help??


in reply to UTF8 support for CSV, PDF formats

As for the CSV files, perhaps adding a BOM would help?  AFAIK, it is widely used on the Windows platform (even with UTF-8) to both indicate that the files do have Unicode content, and to specify the particular encoding being used (UTF-8, UTF-16le, etc.).

For this, the first thing you write to the file should be the BOM (\x{feff}):

my $fname = 'output.csv'; open my $fh, ">:utf8", $fname or die "couldn't open '$fname': $!"; print $fh "\x{feff}"; ...


Comment on Re: UTF8 support for CSV, PDF formats
Select or Download Code
Re^2: UTF8 support for CSV, PDF formats
by vishi83 (Pilgrim) on Jan 10, 2012 at 11:52 UTC
    Thanks for your response. Using BOM, did work for CSV format. I'm able to see the data properly now!
    However, it dint work for PDFs. I"m still trying to figure out a way for that.

    Any thoughts?
    A perl Script without 'strict' is like a House without Roof; Both are not Safe;

      yes, buy a pdf library  open (FILE, ">:encoding(UTF-8)", 'output.pdf'); is a mistake 99% of the time

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://946601]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-11-27 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (187 votes), past polls