# Jdbc input, no filters, csv output =\> CompatibilityError: incompatible encodings: UTF-8 and ASCII-8BIT

**URL:** https://discuss.elastic.co/t/jdbc-input-no-filters-csv-output-compatibilityerror-incompatible-encodings-utf-8-and-ascii-8bit/67484
**Category:** Logstash
**Created:** [November 29, 2016, 1:12pm UTC](https://discuss.elastic.co/t/jdbc-input-no-filters-csv-output-compatibilityerror-incompatible-encodings-utf-8-and-ascii-8bit/67484 "2016-11-29T13:12:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![reuschling](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@reuschling](https://discuss.elastic.co/u/reuschling)
#### Post date: [November 29, 2016, 1:12pm UTC](https://discuss.elastic.co/t/jdbc-input-no-filters-csv-output-compatibilityerror-incompatible-encodings-utf-8-and-ascii-8bit/67484/1 "2016-11-29T13:12:32Z")

</div>

I read out sql server table data with jdbc input plugin, generating a csv file with csv output plugin. At some time (reproducable after a view minutes) it seems that an event has the content that yields to a CompatibilityError: incompatible encodings: UTF-8 and ASCII-8BIT.  
The error takes place both with logstash 2.4.1 and 5.0.1 (with the csv fix from [https://github.com/logstash-plugins/logstash-output-csv/issues/10](https://github.com/logstash-plugins/logstash-output-csv/issues/10)).  
I tried to set the codec=\>plain to utf-8, no change. For me it seems that the csv module tries to create an ASCII file? I can not find any place where to adjust the output encoding. I work on an Linux system, the shell encoding inclusive LANG is set to UTF-8 also.

Encoding::CompatibilityError: incompatible encodings: UTF-8 and ASCII-8BIT\>, :  
backtrace=\>["org/jruby/RubyArray.java:1892:in `join'", "/logstash-5.0.1/vendor/jruby/lib/ruby/1.9/csv.rb:1729:in`\<\<'",  
"/logstash-5.0.1/vendor/jruby/lib/ruby/1.9/csv.rb:1269:in `generate_line'", "/logstash-5.0.1/vendor/jruby/lib/ruby/1.9/csv.rb:2347:in`to\_csv'",  
"/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-csv-3.0.2/lib/logstash/outputs/csv.rb:45:in `multi_receive_encoded'", "org/jruby/RubyArray.java:1613:in`each'",  
"/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-csv-3.0.2/lib/logstash/outputs/csv.rb:37:in `multi_receive_encoded'", "/logstash/logstash-core/lib/logstash/outputs/base.rb:90:in`multi\_receive'",  
"/logstash/logstash-core/lib/logstash/output\_delegator\_strategies/legacy.rb:19:in `multi_receive'", "/logstash/logstash-core/lib/logstash/output_delegator.rb:42:in`multi\_receive'",  
"/logstash/logstash-core/lib/logstash/pipeline.rb:297:in `output_batch'", "org/jruby/RubyHash.java:1342:in`each'",  
"/logstash/logstash-core/lib/logstash/pipeline.rb:296:in `output_batch'", "/logstash/logstash-core/lib/logstash/pipeline.rb:252:in`worker\_loop'",  
"/logstash/logstash-core/lib/logstash/pipeline.rb:225:in `start\_workers'"]}

---

<div class="post-metadata">

### Author: ![reuschling](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@reuschling](https://discuss.elastic.co/u/reuschling)
#### Post date: [November 29, 2016, 2:23pm UTC](https://discuss.elastic.co/t/jdbc-input-no-filters-csv-output-compatibilityerror-incompatible-encodings-utf-8-and-ascii-8bit/67484/2 "2016-11-29T14:23:29Z")

</div>

the line of code in ruby csv.rb (not logstash csv.rb), first line of the stacktrace is

output = row.map(&@quote).join(@col\_sep) + @row\_sep # quote and separate

..so it seems that not the output encoding is the problem, but maybe the rows/according array entries are in different encodings? At least this would be possible in ruby, as I read (I'm not the ruby expert).

---

<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: [December 27, 2016, 2:23pm UTC](https://discuss.elastic.co/t/jdbc-input-no-filters-csv-output-compatibilityerror-incompatible-encodings-utf-8-and-ascii-8bit/67484/3 "2016-12-27T14:23:33Z")

</div>

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