# Reading '¤' separated value file with readdlm

**URL:** https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305
**Category:** General Usage
**Tags:** csv
**Created:** [January 31, 2019, 9:48am UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305 "2019-01-31T09:48:56Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![plapplop](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@plapplop](https://discourse.julialang.org/u/plapplop)
#### Post date: [January 31, 2019, 9:48am UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305/1 "2019-01-31T09:48:56Z")

</div>

I was given a CSV file to study, it contains strings (words enclosed with `"`) separated by the currency sign `'¤'` (don’t ask me why…), and when I used `readdlm` to load its content, the first quote sign is considered to belong to the separator whereas the second one is considered to belong to the actual content, here is a MWE:

```julia
f = open("foo.csv", "w")
write(f, "\"a\"¤\"b\"¤\"c\"\n")
write(f, "\"here is a content\"¤\"here is another one\"¤\"this is enough\"\n")
close(f)

using DelimitedFiles

x, h = readdlm("foo.csv", '¤'; header = true)
@show x[1,1]

```

I can’t find a way to parse it correctly with `readdlm`, any idea?  
Many thanks!

---

<div class="post-metadata">

### Author: ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)
#### Post date: [January 31, 2019, 9:54am UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305/2 "2019-01-31T09:54:30Z")

</div>

FWIW,

```julia
using CSV
h = CSV.read("foo.csv", delim = '¤')
@show x[1,1]
  # x[1, 1] = "here is a content"

```

parses the file correctly

---

<div class="post-metadata">

### Author: ![plapplop](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@plapplop](https://discourse.julialang.org/u/plapplop)
#### Post date: [January 31, 2019, 10:15am UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305/3 "2019-01-31T10:15:03Z")

</div>

Thanks a lot! I have recently been using `readdlm` a lot because for some unknown reason `CSV.read` was extremely slow on previous files with which I was working. But it’s actually fast on these new files, so this solves my problem.

---

<div class="post-metadata">

### Author: ![quinnj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quinnj/32/11_2.png) [@quinnj](https://discourse.julialang.org/u/quinnj)
#### Post date: [January 31, 2019, 4:34pm UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305/4 "2019-01-31T16:34:34Z")

</div>

Yeah, the issue here is I don’t think `readdlm` supports non-ascii delimiters (lots of csv readers don’t). It’s actually newish funcitonality in CSV (as of last fall). If you ever have performance issues w/ CSV.jl, please share! Post here on discourse or open an issue at the JuliaData/CSV.jl repo and I’m happy to help figure out what’s going on.

---

<div class="post-metadata">

### Author: ![plapplop](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@plapplop](https://discourse.julialang.org/u/plapplop)
#### Post date: [January 31, 2019, 4:43pm UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305/5 "2019-01-31T16:43:04Z")

</div>

Thanks @quinnj! I’ll try to find these old files and benchmark them with `CSV.read` and `readdlm` and, if I manage to reproduce the problems I had, post the results either here and tagging you or on the `CSV` repo.

---

<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: [January 31, 2019, 4:51pm UTC](https://discourse.julialang.org/t/reading-separated-value-file-with-readdlm/20305/6 "2019-01-31T16:51:00Z")

</div>

> [@quinnj](#):
>
> It’s actually newish funcitonality in CSV (as of last fall).

If it is an old file, I would suspect it is simply [latin-1](https://en.wikipedia.org/wiki/ISO/IEC_8859-1#Code_page_layout) `0xa4`, instead of an UTF8 `0xc2 0xa4`. Does CSV support non-UTF8 encodings?

Frankly, I would just fix the file with `tr` or a similar tool to have commas, instead of extending support for these cases.
