Code Monkey home page Code Monkey logo

Comments (4)

jiacai2050 avatar jiacai2050 commented on May 30, 2024 1

Sounds good to me

from 1history.

sounisi5011 avatar sounisi5011 commented on May 30, 2024

Notes on exporting RFC4180 compliant CSV files:

  • If the value contains line breaks or double quotes, these values should also be enclosed in double quotes.

    Both characters are percent-encoded in most URLs. However, since percent encoding is not required, double quotes may also be included in URLs.

    Also, double quotes may be included in the page title. If URLs are enclosed in double quotes in the exported CSV file, then I would think that page titles containing double quotes should also be enclosed in double quotes.

  • If the value contains double quotes, each double quote should be escaped.

    Each double quote should be increased to two (" -> ""). For example, the following values are:

    title
    foo
    foo"bar
    bar,baz
    baz""qux
    "quux"
    foo"bar,baz""qux"

    will be written to the CSV as a string like this:

    title
    foo
    "foo""bar"
    "bar,baz"
    "baz""""qux"
    """quux"""
    "foo""bar,baz""""qux"""
    

However, RFC4180 is not a CSV specification. CSV has a history in which different implementations existed for each application without a specification. RFC4180 was defined in response to this, there are still many applications that do not conform to RFC4180. Therefore, there is no need to strictly conform to RFC4180.

Although, I think it is better to comply with RFC4180 as much as possible to include page titles with confusing values such as "foo bar" in the CSV.

from 1history.

jiacai2050 avatar jiacai2050 commented on May 30, 2024

https://docs.rs/csv/latest/csv/ may help implementing this.

from 1history.

sounisi5011 avatar sounisi5011 commented on May 30, 2024

I noticed this bug was fixed when I updated onehistory installed by Cargo. Thank you very much!

from 1history.

Related Issues (13)

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.