# Character encoding problems

**URL:** https://discuss.elastic.co/t/character-encoding-problems/126714
**Category:** Logstash
**Created:** [April 4, 2018, 10:25am UTC](https://discuss.elastic.co/t/character-encoding-problems/126714 "2018-04-04T10:25:14Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Jenni](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jenni/32/29684_2.png) [@Jenni](https://discuss.elastic.co/u/Jenni)
#### Post date: [April 6, 2018, 10:01am UTC](https://discuss.elastic.co/t/character-encoding-problems/126714/5 "2018-04-06T10:01:18Z")

</div>

So my knight is wearing sun glasses – very contemporary 😃

Thank you very much for taking the time to deal with my problem. I really appreciate it.  
And thank you for the "locale charmap" tip. That's good to know. Buuut:

> "message" =\> "UTF-8\n"

And PHP code for the actual use case has

`header('Content-Type: application/json; charset=utf-8');`

So I have no idea what's happening there.

* * *

On a lighter note: [Filter Error ASCII-8BIT to UTF-8 - #2 by yaauie](https://discuss.elastic.co/t/filter-error-ascii-8bit-to-utf-8/124156/2) gave me a workaround that gives me hope.

```
ruby {
  code => '
    hash = event.to_hash
    hash.each do |key,value|
      if value.is_a? String then
        value = value.force_encoding("UTF-8")
      end
    end
  '
}

```

It produces this rubydebug output:

> {  
> "@timestamp" =\> 2018-04-06T09:16:10.795Z,  
> "host" =\> "elasticsearch-vm",  
> "@version" =\> "1",  
> "message" =\> "fühlen",  
> "message2" =\> "fühlen"  
> }

I used the same code for my http poller pipeline and was able to import this into the MySQL database:

> Échame La Culpa

Now I'll just have to wait a few hours until a potentially problematic entry occurs in the other database. If that can be imported successfully, I'm quite happy. It seems like a cumbersome solution for a problem I shouldn't even have. But at least now I'll have nice data.

If someone has a better idea, feel free to post!

* * *

**UPDATE** : "Immer noch fühlen" has been imported from the other database successfully!

---

_[View the full topic](https://discuss.elastic.co/t/character-encoding-problems/126714)._
