# Enconding Issue

**URL:** <https://discuss.elastic.co/t/enconding-issue/2899>\
**Category:** Elasticsearch\
**Created:** [April 8, 2010, 2:15pm UTC](https://discuss.elastic.co/t/enconding-issue/2899 "2010-04-08T14:15:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Walendo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/walendo/32/3348_2.png) [@Walendo](https://discuss.elastic.co/u/Walendo)\
**Post date:** [April 8, 2010, 2:15pm UTC](https://discuss.elastic.co/t/enconding-issue/2899/1 "2010-04-08T14:15:06Z")

</div>

Hi,

I'm trying to PUT an index that is something like the String below  
(portuguese) which is in the ISO-8859-1 charset and the Elastic Server  
sends this error:

JsonParseException[Invalid UTF-8 middle byte 0x6f\n at [Source:  
[B@dd8904; line: 6, column: 58]];

Is there anyway to tell the parser the appopriate encoding to use?

{  
"previsao\_cidade" : {  
"codigo" : 6377,"previsao": {  
"data" : "08/04/2010",  
"nome\_dia" : "Quinta",  
"frase" : "Sol com muitas nuvens durante o dia e períodos de céu  
nublado. Noite com muitas nuvens.",  
"minima" : "23°C",  
"maxima" : "29°C",  
"probabilidade" : "0%",  
"precipitacao" : "0mm",  
"ico\_manha" : "2r",  
"ico\_tarde" : "2r",  
"ico\_noite" : "2rn",  
"uv" : "15",  
"dir\_vento" : "SSE",  
"int\_max\_vento" : "15 nós",  
"int\_vento" : "10 nós",  
"umidade" : "86 %",  
"solnascente" : "05h31",  
"solpoente" : "17h28"  
}  
}

Thanks.  
Jorge

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [April 8, 2010, 2:38pm UTC](https://discuss.elastic.co/t/enconding-issue/2899/2 "2010-04-08T14:38:03Z")

</div>

Hiya

> I'm trying to PUT an index that is something like the String below  
> (portuguese) which is in the ISO-8859-1 charset and the Elastic Server  
> sends this error:

The JSON RFC ([http://www.ietf.org/rfc/rfc4627.txt](http://www.ietf.org/rfc/rfc4627.txt)) specifies that JSON  
must be encoded in Unicode.

So if you're using ISO-8859\* in your application, then your JSON encoder  
(or you, before it reaches the JSON encoder) needs to convert your text  
to Unicode (eg UTF-8) and then will need to convert the results from  
Elasticsearch back into ISO-8859

## clint

Web Announcements Limited is a company registered in England and Wales,  
with company number 05608868, with registered address at 10 Arvon Road,  
London, N5 1PR.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [April 8, 2010, 2:41pm UTC](https://discuss.elastic.co/t/enconding-issue/2899/3 "2010-04-08T14:41:53Z")

</div>

Yep, elasticsearch only support unicode (UTF-8) for JSON and produces  
unicode.

-shay.banon

On Thu, Apr 8, 2010 at 5:38 PM, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:

> Hiya
> 
> > I'm trying to PUT an index that is something like the String below  
> > (portuguese) which is in the ISO-8859-1 charset and the Elastic Server  
> > sends this error:
> 
> The JSON RFC ([http://www.ietf.org/rfc/rfc4627.txt](http://www.ietf.org/rfc/rfc4627.txt)) specifies that JSON  
> must be encoded in Unicode.
> 
> So if you're using ISO-8859\* in your application, then your JSON encoder  
> (or you, before it reaches the JSON encoder) needs to convert your text  
> to Unicode (eg UTF-8) and then will need to convert the results from  
> Elasticsearch back into ISO-8859
> 
> ## clint
> 
> Web Announcements Limited is a company registered in England and Wales,  
> with company number 05608868, with registered address at 10 Arvon Road,  
> London, N5 1PR.

---

<div class="post-metadata">

**Author:** ![Walendo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/walendo/32/3348_2.png) [@Walendo](https://discuss.elastic.co/u/Walendo)\
**Post date:** [April 8, 2010, 7:41pm UTC](https://discuss.elastic.co/t/enconding-issue/2899/4 "2010-04-08T19:41:36Z")

</div>

Great! Thanks a lot.

On 8 abr, 11:41, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Yep, elasticsearch only support unicode (UTF-8) for JSON and produces  
> unicode.
> 
> -shay.banon
> 
> On Thu, Apr 8, 2010 at 5:38 PM, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk)wrote:
> 
> > Hiya
> 
> > > I'm trying to PUT an index that is something like the String below  
> > > (portuguese) which is in the ISO-8859-1 charset and the Elastic Server  
> > > sends this error:
> 
> > The JSON RFC ([http://www.ietf.org/rfc/rfc4627.txt](http://www.ietf.org/rfc/rfc4627.txt)) specifies that JSON  
> > must be encoded in Unicode.
> 
> > So if you're using ISO-8859\* in your application, then your JSON encoder  
> > (or you, before it reaches the JSON encoder) needs to convert your text  
> > to Unicode (eg UTF-8) and then will need to convert the results from  
> > Elasticsearch back into ISO-8859
> 
> > ## clint
> > 
> > Web Announcements Limited is a company registered in England and Wales,  
> > with company number 05608868, with registered address at 10 Arvon Road,  
> > London, N5 1PR.

---

<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 6, 2017, 4:24am UTC](https://discuss.elastic.co/t/enconding-issue/2899/5 "2017-07-06T04:24:45Z")

</div>


