Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Problem with special characters in a csv file

by matija (Priest)
on Jul 22, 2004 at 05:17 UTC ( #376474=note: print w/ replies, xml ) Need Help??


in reply to Problem with special characters in a csv file

One possible solution is to open CSV something like this:

my $csv = Text::CSV_XS->new ({'always_quote' => 1, 'eol' => "\n", 'binary' => 1, });
That will allow "funny characters" directly in the CSV file.

If you are determined to change the characters to entities, you could do it something like this:

$string=~s/[\x7f-\xff\&]/"&#".ord($1).";"/ge;


Comment on Re: Problem with special characters in a csv file
Select or Download Code
Replies are listed 'Best First'.
Re^2: Problem with special characters in a csv file
by shilpam (Sexton) on Jul 22, 2004 at 08:54 UTC
    Thanks a lot! The solution worked!!!
Re^2: Problem with special characters in a csv file
by Anonymous Monk on Apr 16, 2011 at 08:10 UTC
    I had the same problem with csv files, but i solved it with saving my Excel file to txt and then just replacing (with replace all)tabs with comas, and I used the txt file for the print merge.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-08 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls