# Words with some special character arenot displayed well after elasticsearch injection

**URL:** <https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 15, 2021, 2:56pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025 "2021-06-15T14:56:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![F\_Abde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f_abde/32/90348_2.png) [@F\_Abde](https://discuss.elastic.co/u/F_Abde)\
**Post date:** [June 15, 2021, 2:56pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/1 "2021-06-15T14:56:32Z")

</div>

Hello, I need you help,  
My data looks like this (My json files)

```auto
{"index": {"_id":2530}}
{"visitor_id": "4395667", "timestamp": "2020-08-07T10:24:00Z", "station_id": "Place A"}
{"index": {"_id":2531}}
{"visitor_id": "4395668", "timestamp": "2020-08-07T11:09:55Z", "station_id": "Réaumur"}

```

I use curl command to injected in Elasticsearch  
` curl -s -H "Content-Type:application/json" -XPOST http://localhost:9200/gpsdata/log/_bulk?pretty --data-binary "@%%f"`

I am working with Python Elastic search to do some queries on my data, for example :

```auto
es = Elasticsearch('http://localhost:9200')
search_param={
"size": 0,
"aggs" : {
    "langs" : {
        "terms" : { "field" : "station_id.keyword"}
    }
}}

response = es.search(index="gpsdata", body=search_param)
response['aggregations']

```

The result I get in after running python code is :

```auto

{'langs': {'doc_count_error_upper_bound': 0,
  'sum_other_doc_count': 0,
  'buckets': [{'key': 'Dor', 'doc_count': 639},
   {'key': 'RÃ©aumur', 'doc_count': 92},
   {'key': 'PlaceA', 'doc_count': 61},
   {'key': 'CurÃ© Crampette', 'doc_count': 33},
   {'key': 'Le PrieurÃ©', 'doc_count': 17},

```

The words with accent like "Réaumur" are not displayed well, Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 15, 2021, 3:10pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/2 "2021-06-15T15:10:48Z")

</div>

Bonjour and welcome!

It's probably because you are not using `UTF-8` to encode your text. Elasticsearch expects `UTF-8`.  
Most likely you are using `ISO-8859-1`

---

<div class="post-metadata">

**Author:** ![F\_Abde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f_abde/32/90348_2.png) [@F\_Abde](https://discuss.elastic.co/u/F_Abde)\
**Post date:** [June 15, 2021, 10:56pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/3 "2021-06-15T22:56:09Z")

</div>

Thanks for you answer, if you could please tell me how I can use **UTF-8** encoding?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 15, 2021, 11:21pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/4 "2021-06-15T23:21:04Z")

</div>

Check the encoding of your json files.

---

<div class="post-metadata">

**Author:** ![F\_Abde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f_abde/32/90348_2.png) [@F\_Abde](https://discuss.elastic.co/u/F_Abde)\
**Post date:** [June 16, 2021, 9:10am UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/5 "2021-06-16T09:10:16Z")

</div>

When I opend my JSON files with Windows 10 notepad it shows something like this : "F\u00c3\u00a9tilly" and in the bottom of the notepad it is mentionned "UTF-8"  
Is the problem in decoding those characters or they are broken from the origins?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 16, 2021, 10:14am UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/6 "2021-06-16T10:14:09Z")

</div>

I can't tell. Share the file somewhere and I'll give a look.

---

<div class="post-metadata">

**Author:** ![F\_Abde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f_abde/32/90348_2.png) [@F\_Abde](https://discuss.elastic.co/u/F_Abde)\
**Post date:** [June 16, 2021, 10:24am UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/7 "2021-06-16T10:24:33Z")

</div>

I could not ulpoaded here, I upload it instead on my google drive and here is a link for it:

> **[265626570.json](https://drive.google.com/file/d/1CITJu4neyxuLSLegGYWnOzacj-E58wt_/view?usp=sharing)**
>
> Google Drive file.

The file looks like this : (the field where I have the problem is "module\_nb"):

```auto
{"265626570": [{"visitor_id": "265626570", "timestamp": "2020-08-11T17:47:13Z", "station_id": "UNKNOWN", "module_nb": "F\u00c3\u00a9tilly",..

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 16, 2021, 4:17pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/8 "2021-06-16T16:17:21Z")

</div>

Try with:

[https://gist.githubusercontent.com/dadoonet/55b88a88d789a0dcfd9f722ad85a65bb/raw/b27f08892c83b0b99b6279ee56c5cb9158ef45f4/265626570.json](https://gist.githubusercontent.com/dadoonet/55b88a88d789a0dcfd9f722ad85a65bb/raw/b27f08892c83b0b99b6279ee56c5cb9158ef45f4/265626570.json)

I changed the bad characters to UTF8 encoded accents.

---

<div class="post-metadata">

**Author:** ![F\_Abde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/f_abde/32/90348_2.png) [@F\_Abde](https://discuss.elastic.co/u/F_Abde)\
**Post date:** [June 16, 2021, 11:49pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/9 "2021-06-16T23:49:52Z")

</div>

Thank you so much for your time, sorry if my question wasn't clear in the beginning, I am a beginner...

For people that may have the same problem further : try to change bad character, or check from the source you get your data and it should be UTF-8 encoded.

---

<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 14, 2021, 11:50pm UTC](https://discuss.elastic.co/t/words-with-some-special-character-arenot-displayed-well-after-elasticsearch-injection/276025/10 "2021-07-14T23:50:47Z")

</div>

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