mabart / parsecsv-for-php

Automatically exported from code.google.com/p/parsecsv-for-php
MIT License
0 stars 0 forks source link

Escaped enclosure character not supported #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Read a file having columns that use an enclosure character such as a 
double-quote.
2. Include a field value that uses an escape character (backslash) then a 
double-quote as part of the data such as "Tom's height was 5'9\" when he was 12 
years old". 

What is the expected output? 
A value containing a double-quote within the data.
Tom's height was 5'9" when he was 12 years old

What do you see instead?
Data that ends due to the presence of the escaped double-quote.
Tom's height was 5'9\

What version of the product are you using? 
v0.3.2 and v0.4.3 beta

On what operating system?
Any

Please provide any additional information below.
The Wikipedia "Comma-separated values" article was provided as the 
specification reference. The article states "Embedded double quote characters 
may then be represented by a pair of consecutive double quotes (Creativyst 
2010), or by prefixing an escape character such as a backslash (for example in 
Sybase Central)."

I do not have control over the input file so I added the following to v0.4.3 
beta before line 413
} elseif ($pch == "\\") {
//do nothing; enclosure character may be escaped with a backslash

This needs more code but got me through my problem.

Original issue reported on code.google.com by wardje...@gmail.com on 20 Oct 2014 at 10:15

GoogleCodeExporter commented 8 years ago
Work on this project has moved to GitHub. Would you mind submitting and issue 
on the project there instead so we can properly deal with it? 

https://github.com/parsecsv/parsecsv-for-php

Thanks :) 

Original comment by cont...@jimeh.me on 21 Oct 2014 at 6:25