csv's People
csv's Issues
Propose a solution to customize quoting behaviour
Problem
I found 6 similar issues with parsing quoted fields in Go’s built-in CSV package encoding/csv
. In this proposal, I show a solution that allows encoding/csv
to handle all of those cases.
Firstly, CSV inputs in the above-mentioned issues do not conform to RFC 4180 format that encoding/csv
follows. Some of them seem to be bad data.
For example, Issue #56329 expects "a"b"c",123,
to be parsed as [a"b"c,123,]
. This allows single quotes within quoted fields. If the quoted b
was a comma that we try to escape, we see the problem:
“a”,”c”,123,
The input can be interpreted as
[a, c, 123]
or
[a”,”c, 123]
Solution
In this proposal, I want to introduce a function parameter that allows users to modify the malformed CSV input and utilize what has been built at the same time.
The modified parser looks like this:
Lines 295 to 323 in f0ad461
This design allows encoding/csv
to handle malformed CSV inputs. It introduces a possibility for encoding/csv
to support other CSV formats.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.