# Error parsing CSV - Illegal quoting with non-ascii (default)

**URL:** <https://discuss.elastic.co/t/error-parsing-csv-illegal-quoting-with-non-ascii-default/83279>\
**Category:** Logstash\
**Created:** [April 22, 2017, 1:22pm UTC](https://discuss.elastic.co/t/error-parsing-csv-illegal-quoting-with-non-ascii-default/83279 "2017-04-22T13:22:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![niels1189](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@niels1189](https://discuss.elastic.co/u/niels1189)\
**Post date:** [April 22, 2017, 1:22pm UTC](https://discuss.elastic.co/t/error-parsing-csv-illegal-quoting-with-non-ascii-default/83279/1 "2017-04-22T13:22:29Z")

</div>

CSV Line: "Mañe"###"email@gmail.com"###"3563454"###"255.255.255.255"

:source=\>"\\"Man\\xF1e\\"###\\"email@gmail.com\\"###\\"3563454\\"###\\"255.255.255.255\\"",:exception=\># CSV::MalformedCSVError: Illegal quoting in line 1. }

Logstash config:  
input {  
stdin {  
type =\> "csv"  
}  
}

filter {  
csv {  
columns =\> ["username","email","entry","ip"]  
separator =\> "###"  
remove\_field =\> ["message","@timestamp","path","type","host"]  
}  
}

output {  
elasticsearch {  
template =\> "template.json"  
action =\> "index"  
hosts =\> ["192.168.1.19:9200"]  
index =\> "data-2016"  
template\_overwrite=\>true  
codec =\> plain  
{ charset =\> "ISO-8859-1" }  
}  
}

I added the codec as a method to change the way it handles the special characters. But this seems to happen with every entry that contains a non default ascii value.

examples: \xA3 \xB8, \xCE, \xE4, \xBC, \xE8

I want to add that I'm absolutely sure all fields having this issue are quoted correctly. Fields containing a " have been escaped with a ". i.e. "alpha"###"james@james.com"###"I am ""who I am"""###"255.255.255.255"

---

<div class="post-metadata">

**Author:** ![niels1189](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@niels1189](https://discuss.elastic.co/u/niels1189)\
**Post date:** [April 22, 2017, 3:37pm UTC](https://discuss.elastic.co/t/error-parsing-csv-illegal-quoting-with-non-ascii-default/83279/2 "2017-04-22T15:37:57Z")

</div>

Resolved -

Solution:  
file -bi   
Showed me the file was using charset iso-8859-1

Adding the codec to the input solves this.

stdin {  
type =\> "csv"  
codec =\> plain { charset =\> "ISO-8859-1" }  
}

This also means that the output codec can go back to the default UTF-8 and it will still work.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 20, 2017, 3:42pm UTC](https://discuss.elastic.co/t/error-parsing-csv-illegal-quoting-with-non-ascii-default/83279/3 "2017-05-20T15:42:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
