# Space after quoted field breaks delimited file parsing

**URL:** https://discourse.julialang.org/t/space-after-quoted-field-breaks-delimited-file-parsing/21531
**Category:** General Usage
**Tags:** csv
**Created:** [March 6, 2019, 10:51am UTC](https://discourse.julialang.org/t/space-after-quoted-field-breaks-delimited-file-parsing/21531 "2019-03-06T10:51:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [March 6, 2019, 10:51am UTC](https://discourse.julialang.org/t/space-after-quoted-field-breaks-delimited-file-parsing/21531/1 "2019-03-06T10:51:28Z")

</div>

`DelimitedFiles` can not parse a file that has an extra space after a quoted field:

```julia
txt = "a,\"b\" " # note the extra space at the end there
file = "tmp.csv"
open(file, "w") do io
    print(io, txt)
end
using DelimitedFiles
x = readdlm(file, ',') # ERROR: unexpected character ' ' after quoted field at row 1 column 2

```

But [CSV](https://github.com/JuliaData/CSV.jl) manages alright:

```julia
julia> using CSV, Tables

julia> x = CSV.File(file, header = ["h1", "h2"]) |> Tables.columntable
(h1 = Union{Missing, String}["a"], h2 = Union{Missing, String}["b"])
```

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [March 6, 2019, 11:14am UTC](https://discourse.julialang.org/t/space-after-quoted-field-breaks-delimited-file-parsing/21531/2 "2019-03-06T11:14:23Z")

</div>

> [@yakir12](#):
>
> extra space after a quoted field

Since CSV is not a standardized format (despite [some efforts](https://en.wikipedia.org/wiki/Comma-separated_values#Standardization)), “extra” whitespace may be considered invalid by some parsers. You can also think of this as a feature (validation).

The usual adage applies: if you need quoted fields, you shouldn’t use CSV. 😉

---

<div class="post-metadata">

### Author: ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)
#### Post date: [March 6, 2019, 11:28am UTC](https://discourse.julialang.org/t/space-after-quoted-field-breaks-delimited-file-parsing/21531/3 "2019-03-06T11:28:36Z")

</div>

Yup, makes sense. I’ve noticed this before: `DelimitedFiles` is robust and light, `CSV` has more features.
