# Logstash - Charset 1252 - Problems with Conversion

**URL:** <https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729>\
**Category:** Logstash\
**Created:** [May 31, 2017, 11:45am UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729 "2017-05-31T11:45:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lgarcia](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lgarcia](https://discuss.elastic.co/u/lgarcia)\
**Post date:** [May 31, 2017, 11:45am UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/1 "2017-05-31T11:45:49Z")

</div>

Hi everyone

I have been struggling with Logstash to be able to apply the windows charset CP1252 in a UDP input listener. I'm running on a windows server 2012 with Logstash 5.2.2.

The charset setup seems does not make effect and after I sent the data I see the character like that:  
Sent data : [é ó ção]  
Result in Elastic : [\xE9 \xF3 \xE7\xE3o]

The UDP setup follows below.

input  
{  
udp  
{  
port =\> 5140  
codec =\> plain  
{  
charset =\> "CP1252"  
}  
type =\> "log4net"  
}  
}

The output setup is an ElasticSearch as follows

output  
{  
stdout{  
codec =\> rubydebug  
}  
if[type] =="log4net"{  
elasticsearch{  
hosts =\> ["localhost:9200"]  
index =\> "log-%{+YYYY.MM.dd}"   
}  
}  
}

I did a try sending direct to ElasticSearch without Logstash and it worked.

Any tips to solve it is very welcome

Thanks & Regards

---

<div class="post-metadata">

**Author:** ![lgarcia](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lgarcia](https://discuss.elastic.co/u/lgarcia)\
**Post date:** [June 6, 2017, 8:51pm UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/2 "2017-06-06T20:51:10Z")

</div>

After some more tests, it seems that the problem should be happen when grok apply the filter before it goes to output.  
Has anyone experienced this issue?

Thanks

---

<div class="post-metadata">

**Author:** ![pts0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pts0/32/17811_2.png) [@pts0](https://discuss.elastic.co/u/pts0)\
**Post date:** [June 6, 2017, 8:54pm UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/3 "2017-06-06T20:54:43Z")

</div>

I don't see any grok in your config

---

<div class="post-metadata">

**Author:** ![lgarcia](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lgarcia](https://discuss.elastic.co/u/lgarcia)\
**Post date:** [June 7, 2017, 4:41pm UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/4 "2017-06-07T16:41:01Z")

</div>

Sorry, the filter is:

filter  
{  
if [type] == "log4net"  
{  
grok  
{  
remove\_field =\> message  
match =\> { message =\> "(?m)%{TIMESTAMP\_ISO8601:sourceTimestamp} %{DATA:userName} %{WORD:machineName} %{DATA:loggerName}: %{DATA:threadId} %{LOGLEVEL:level} %{DATA:systemname} %{WORD:environment} %{WORD:site} %{GREEDYDATA:tempMessage}" }  
}  
if !("\_grokparsefailure" in [tags])  
{  
mutate {  
replace =\> ["message" , "%{tempMessage}"]  
}  
}  
mutate {  
remove\_field =\> ["tempMessage"]  
remove\_field =\> ["tempHost"]  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![pts0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pts0/32/17811_2.png) [@pts0](https://discuss.elastic.co/u/pts0)\
**Post date:** [June 8, 2017, 6:58am UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/5 "2017-06-08T06:58:18Z")

</div>

I really don't understand your question, sorry.  
What you mean

> [@lgarcia](#):
>
> it seems that the problem should be happen when grok apply the filter before it goes to output.

---

<div class="post-metadata">

**Author:** ![lgarcia](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lgarcia](https://discuss.elastic.co/u/lgarcia)\
**Post date:** [June 8, 2017, 5:08pm UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/6 "2017-06-08T17:08:56Z")

</div>

When I send a given message to logstash, lets say "[é ó ção]" it seems that after the filter process the is performed by a grok codec to transform the message, the initial value that was "[é ó ção]" is wrongly converted to this the characteres "\xE9 \xF3 \xE7\xE3o". I'm not understanding what's the reason of it's behavior . If I remove the filter step, the message arrives in the right way to the output since I can see it in Kibana.

---

<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, 5:09pm UTC](https://discuss.elastic.co/t/logstash-charset-1252-problems-with-conversion/87729/7 "2017-07-06T17:09:04Z")

</div>

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