Comments (10)
Thanks for reporting this. I added a unit test to parse the exact text you provided, and it seems to have no problem with it. I tried parsing it as the in-memory string, and as a file written to disk (which is similar to what your code was doing). Both tests pass without modification to the parser, so I'm not sure what the issue is here.
from chcsvparser.
Are the URLs you're parsing remote (coming in over a network connection) or local file URLs? Do you have an example of either that I could try?
from chcsvparser.
Hi Dave,
I'm downloading an archive from the server, unpack it into Documents directory and supply a URL to the file in Documents dir.
You can find the files I'm using in the following archive: http://metro4all.org/data/msk.zip
The file I've encountered the problem in is portals_ru.csv
from chcsvparser.
Thanks @marvin-yorke. I incorporated the portals.csv
file into the unit tests, but they're still passing on my machine. 😕
from chcsvparser.
Hm, ok, I've cloned the repo and run the tests and it works on my machine too. I should have mentioned that original case was observed on iOS, not OS X. Could this make any difference? Also I've installed the library from Cocoapods, not from github, although there's no major difference to the latest code.. Anyway, I'll try again with my iOS app and let you know about the results
from chcsvparser.
I've checked the issue again and here's the line that breaks the parsing
17530;2;"Крокус Экспо" (павильон 1, 2);215;both;55.8235522598;37.3855503584;800;56;0;0;0;400;950;23;0
Turns out that it's not parentheses that cause the issue, but quotes. And now I'm not quite sure whether it's a parser problem or my data is malformed. What do you think?
from chcsvparser.
Yes, that is a problem with the data. When the parser encounters a field that starts with "
, it assumes the field ends with the corresponding closing "
. And then since the next character after the closing "
isn't a delimiter (;
), it aborts with an error.
from chcsvparser.
Then could you please help me on how to correct my data?
from chcsvparser.
The solutions seems pretty clear: don't start an field with quoted text; or if a field starts with quoted text wrap the whole field in quotes.
from chcsvparser.
Is there a property that can turn of such behavior. Or some work around without me having to edit the file I am parsing.
Edit: added one seems to work fine now :)
from chcsvparser.
Related Issues (20)
- Four warnings when I build. Xcode 7.3, targeting iOS 8 or later. HOT 4
- issue with (º)degree symbol at time of export HOT 2
- When open a csv file in appending mode, set the _currentLine the last line number of the file
- Exception raised when using -writeLineWithDictionary: to append records
- Fails to parse line with backslashed quotes, even with 'recognize backslashes' option
- Swift delegate prototypes (a comment, not an issue) HOT 2
- Parsed Data Replaces Double Quotes with Two Sets of Double Quotes HOT 1
- unable to parse csv file with initWithContentsOfCSVFile HOT 1
- Parsing ends if field includes nullchar HOT 1
- Thoughts on providing SAX style parsing
- The parser doesn't see field when it contains unescaped '\n' HOT 1
- Two warnings when building using XCode 7 Beta 5 HOT 16
- tvos support HOT 2
- NSInputStream inputStreamWithURL always nil HOT 1
- Using the 3.0.0 Version in Swift HOT 1
- Output parsing to an Array? HOT 1
- writeField:(id)field raises exception if first line of CSV has any null field HOT 1
- Typo in readme.markdown
- Use a proper CSV writer HOT 1
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.
from chcsvparser.