GithubHelp home page GithubHelp logo

Comments (7)

Tux avatar Tux commented on July 16, 2024

Sorry, but you did not mention one critical issue that causes the behavior you see, as in the default setup, it works exactly as documented:

$ perl -MText::CSV_XS -e'Text::CSV_XS->new->say(*STDOUT,[map{$_//"\\N"}"blah",undef,3])'
blah,\N,3

But I am sure you have setup your instance with { escape => "\\" }, which causes the need to escape the escape, and fields that have escapes in them are automatically quoted:

$ perl -MText::CSV_XS -e'Text::CSV_XS->new({escape=>"\\"})->say(*STDOUT,[map{$_//"\\N"}"blah",undef,3])'
blah,"\\N",3

I'll see if there can be a more explicit attribute to achieve this, as callbacks are not an option to make this combination work.

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

Try a pull/clone from here. I added the undef_str attribute:

$ perl -Mblib -MText::CSV_XS -e'Text::CSV_XS->new({escape=>"\\",undef_str=>"\\N"})->say(*STDOUT,["blah",undef,3])'perl -Mblib -MText::CSV_XS -e'Text::CSV_XS->new({escape=>"\\",undef_str=>"\\N"})->say(*STDOUT,["blah",undef,3])'
blah,\N,3

See https://github.com/Tux/Text-CSV_XS/blob/master/doc/CSV_XS.md#undef_str

from text-csv_xs.

dankasak avatar dankasak commented on July 16, 2024

Wow, that's great! Thankyou so much for the fast response and patch.

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

Feedback would be more than welcome BTW.
I saw it failed tests on 5.18.x and below, so I cannot release yet.
(and I just pushed a patch that allows UTF-8 values for undef_str, where (U+002205) springs to mind as useful :)

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

@dankasak would you be so kind to pull/clone again? I changed a lot of code to make it work on 5.18.x and below. If my tests do not cover all issues, your code might.
Any other feedback for now?

from text-csv_xs.

dankasak avatar dankasak commented on July 16, 2024

I've pulled and re-tested, using a couple of options for supporting different databases. Looks good to me :)

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

Thanks for the feedback. I'll start the big test-to-release process

from text-csv_xs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.