Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: CSV file

by dorward (Curate)
on May 20, 2009 at 14:37 UTC ( #765242=note: print w/ replies, xml ) Need Help??


in reply to Re: CSV file
in thread CSV file

Does \, work in CSV? I thought you have to quote bits of data that included commas? Even if a simple escape like that is OK, what if the data includes \ characters? Or new lines?

Simple data formats very rarely are. Use the modules, they are robust.


Comment on Re^2: CSV file
Re^3: CSV file
by Polyglot (Monk) on May 20, 2009 at 15:54 UTC
    For the record there is currently no such thing as a standard CSV format.

    If you are using Microsoft Excel, it will encapsulate each "cell" of data in quotes, instead of escaping the commas. However, what if the cells have quote marks? I suppose they would need to be escaped if using that format. I found the following "guide" to CSV online.


    Considerations When Exporting CSV

    The biggest differences are in how these three characters are handled.
    • Embedded double quotes in fields.
      An escape character is sometimes used to introduce a double quote, or in place of it.
    • Embedded line-feeds in fields.
      This one is also escaped sometimes. Often like in C ("\n")
    • Embedded commas in fields.
      Again, an escape character is sometimes used in place of the comma
    Theoretically, if you could avoid exporting any fields that include these characters you would greatly improve the chances that your CSV file could be read by variations.

    Is it worth reducing your application's functionality or convenience? No. But if the existence of these characters is entirely superfluous, you might consider taking them out.


    Take your pick. I picked one format. There are others.

    Blessings,

    ~Polyglot~

      Thanks a ton all of you guys... i will try these and let you know what comes up.. :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-08-28 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls