Hello great minds,

I'm facing issues in writing unicode characters from a data file to CSV or PDF formats in perl.

The concept i'm trying with perl is,
I've a file which has non-english characters.. For example, i'm using japanese characters. I"m trying to write these japanese characters to various formats. I was able to view this file as html in browser or as excel. All i had to do is to support by application with charset: utf-8 encoding.

But to create a CSV or a PDF file, i'm writing this japanese content using file open(). Here, i tried the below way,

open (FILE, ">:encoding(UTF-8)", 'output.csv');
(or) open (FILE, ">:encoding(UTF-8)", 'output.pdf');

i also tried, binmode(FH, ":utf8");

i also tried using,
Text::CSV->new( { encoding => "utf8" } )

In any of these methods, i'm able to see the output in notepad or browser.. but when i open the CSV file in the excel, i don't see the japanese characters properly

From your expertise, can you please suggest me how to go about this and provide some ideas, pls?

Thanks....

In reply to UTF8 support for CSV, PDF formats by vishi83

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.