# Logstash Invalid Character for UTF-16/Unicode encoding

**URL:** <https://discuss.elastic.co/t/logstash-invalid-character-for-utf-16-unicode-encoding/56702>\
**Category:** Logstash\
**Created:** [July 29, 2016, 7:02am UTC](https://discuss.elastic.co/t/logstash-invalid-character-for-utf-16-unicode-encoding/56702 "2016-07-29T07:02:20Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [June 21, 2017, 2:11pm UTC](https://discuss.elastic.co/t/logstash-invalid-character-for-utf-16-unicode-encoding/56702/6 "2017-06-21T14:11:21Z")

</div>

The question-mark-in-black-diamond character is a replacement character that is used when the UTF16 -\> UTF8 character conversion fails.

This piece of config `codec => plain { charset => "UTF-16" }` says to Logstash "Treat all text as UTF16 and convert it to UTF8"

There may be some illegal surrogates [http://unicode.org/faq/utf\_bom.html#utf16-7](http://unicode.org/faq/utf_bom.html#utf16-7)  
or maybe the charset conversion library we use does not deal with noncharacters [http://www.unicode.org/faq/private\_use.html#noncharacters](http://www.unicode.org/faq/private_use.html#noncharacters) very well.

---

_[View the full topic](https://discuss.elastic.co/t/logstash-invalid-character-for-utf-16-unicode-encoding/56702)._
