# Getting characters to be stored correctly

**URL:** <https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981>\
**Category:** Elasticsearch\
**Created:** [September 20, 2016, 7:58am UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981 "2016-09-20T07:58:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tonni\_Hult](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tonni_hult/32/11992_2.png) [@Tonni\_Hult](https://discuss.elastic.co/u/Tonni_Hult)\
**Post date:** [September 20, 2016, 7:58am UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/1 "2016-09-20T07:58:52Z")

</div>

Hi

I am having a problem to get for exampel chinese characters to be stored correctly in ElasticSearch (we use version 2.3.2).

In my index I have a mapping for the field Username that is set like this

```
"Username": {
  "type": "string",
  "index": "not_analyzed"
}

```

We don't need to analyze the field but we must be able to handle usernames in russian, chinese, arabic etc. Testing the mapping to see what token it produces seems to give the right result when calling [http://localhost:9200/logstash-dev-2016.09.19/\_analyze?field=Username&text=灵铃理立](http://localhost:9200/logstash-dev-2016.09.19/_analyze?field=Username&text=%E7%81%B5%E9%93%83%E7%90%86%E7%AB%8B)

{  
"tokens": [  
{  
"token": "灵铃理立",  
"start\_offset": 0,  
"end\_offset": 4,  
"type": "word",  
"position": 0  
}  
]  
}

But when I insert a document in ES and then search for it in Kibana (4.5.4) I get a result like ç�µé“ƒç�†ç«‹  
What am I doing wrong?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 20, 2016, 10:31am UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/2 "2016-09-20T10:31:02Z")

</div>

Can you try to force your browser to use UTF8 as an encoding? Does it fix the issue?

---

<div class="post-metadata">

**Author:** ![Tonni\_Hult](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tonni_hult/32/11992_2.png) [@Tonni\_Hult](https://discuss.elastic.co/u/Tonni_Hult)\
**Post date:** [September 21, 2016, 6:52am UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/3 "2016-09-21T06:52:37Z")

</div>

I tested with Chrome and that setting is not available for me, the encoding menu is greyed out. But I don't think that would solve the problem because when I use Postman and do the same search there I get the same result.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 21, 2016, 7:22am UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/4 "2016-09-21T07:22:02Z")

</div>

Well there is something that messes up with the encoding. I don't think the issue is with Elasticsearch itself as there are many users that use it with chinese or russian content successfully.

When you call the search API the same way as you call the analyze API (since the latter seems to work for you), do you still have encoding issues? If yes then the issue might be at index time due to a client that uses a different encoding than the one it declares.

---

<div class="post-metadata">

**Author:** ![Tonni\_Hult](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tonni_hult/32/11992_2.png) [@Tonni\_Hult](https://discuss.elastic.co/u/Tonni_Hult)\
**Post date:** [September 21, 2016, 11:05am UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/5 "2016-09-21T11:05:44Z")

</div>

Well you're right it doesn't seem to be ES because I've found that the username is wrong even before it is inserted into ES. Nxlog is used as our shipper and from there the username looks ok but when I looked the output from LS the username is wrong. In between is Redis and a loadbalancer so I need to find where the problem starts

---

<div class="post-metadata">

**Author:** ![Tonni\_Hult](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tonni_hult/32/11992_2.png) [@Tonni\_Hult](https://discuss.elastic.co/u/Tonni_Hult)\
**Post date:** [September 22, 2016, 2:26pm UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/6 "2016-09-22T14:26:31Z")

</div>

Finally found the problem! In my input configuration in LS I had the following setting

`{charset => "CP1252"}`

Removing that made it default back to UTF-8 and all works fine! Thanks for pointing me in the right direction

---

<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:** [July 5, 2017, 10:18pm UTC](https://discuss.elastic.co/t/getting-characters-to-be-stored-correctly/60981/7 "2017-07-05T22:18:06Z")

</div>


