Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Writing a .txt file for import in Excel with UTF-8 BOM

by bradcathey (Prior)
on Aug 25, 2017 at 00:20 UTC ( [id://1197976]=note: print w/replies, xml ) Need Help??


in reply to Re: Writing a .txt file for import in Excel with UTF-8 BOM
in thread Writing a .txt file for import in Excel with UTF-8 BOM

Yes, I did learn that you can import the file into Excel with UTF-8 as an option and all is fine but trying to make the experience for the client a little smoother. I guess MS doesn't take UTF-8 straight out of the box. Strange.

I have used Excel::Template in the past, but for my purposes it would be complicated to set up and looking for something quick. But nothing is quick when programming, right.

Thanks!

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re^3: Writing a .txt file for import in Excel with UTF-8 BOM
by poj (Abbot) on Aug 25, 2017 at 06:09 UTC

    If you want to open the file in Excel with a double mouse click rather than using the text import wizard, File::BOM will work or just add another print line to your script.

    #!perl use strict; use utf8; #use File::BOM(); #open my $fh, '>:utf8 :via(File::BOM)','output_with_bom.csv' # or die "$!"; open my $fh, '>:utf8','output_with_bom.csv' or die "$!"; print $fh chr(0xFEFF); # U+FEFF is EF BB BF as utf-8 print $fh $_ for <DATA>; close $fh; __DATA__ a,1 b,2 ©,3 ®,4
    poj

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-28 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found