Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: Why Doesn't Text::CSV_XS Print Valid UTF-8 Text When Used With the open Pragma? ("XS")

by remiah (Hermit)
on Oct 02, 2011 at 14:38 UTC ( #929152=note: print w/replies, xml ) Need Help??


in reply to Re^4: Why Doesn't Text::CSV_XS Print Valid UTF-8 Text When Used With the open Pragma? ("XS")
in thread Why Doesn't Text::CSV_XS Print Valid UTF-8 Text When Used With the open Pragma?

Probably, Text::CSV::Encoded is what you are looking for.
use Text::CSV::Encoded; my $csv = Text::CSV::Encoded->new ({binary=>1, encoding=>"utf8"}) or d +ie $!; while (my $row = $csv->getline (*ARGV)) { $csv->print(\*STDOUT, $row); }
This works fine with my perl 5.12.2, with command line ...
perl test.pl test.csv
  • Comment on Re^5: Why Doesn't Text::CSV_XS Print Valid UTF-8 Text When Used With the open Pragma? ("XS")
  • Select or Download Code

Replies are listed 'Best First'.
Re^6: Why Doesn't Text::CSV_XS Print Valid UTF-8 Text When Used With the open Pragma? ("XS")
by Tux (Abbot) on Oct 02, 2011 at 15:52 UTC

    Text::CSV::Encoded is indeed a nice extension to the Text::CSV parser family, but it does solve the underlying problem as stated in the original quest. use encoding ... is (or now was) broken in combination with XS code. Most bugs that stem from that are workaround-able by using other encode/decode approaches, but it is (or was) still a bug.


    Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929152]
help
Chatterbox?
[james28909]: i found a demo in the PDK samples, and it works there, so just need to figure out what im doing wrong.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-07-28 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (430 votes). Check out past polls.