# Find and replace to a unicode string

**URL:** <https://discuss.elastic.co/t/find-and-replace-to-a-unicode-string/252226>\
**Category:** Logstash\
**Created:** [October 15, 2020, 3:35pm UTC](https://discuss.elastic.co/t/find-and-replace-to-a-unicode-string/252226 "2020-10-15T15:35:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 15, 2020, 10:11pm UTC](https://discuss.elastic.co/t/find-and-replace-to-a-unicode-string/252226/2 "2020-10-15T22:11:07Z")

</div>

The logstash configuration language does not provide a way to specify UTF-8 characters. You will need to use a ruby filter to do the gsub

```
ruby { code => 'event.set("message", event.get("message").gsub(/\|/, "\0001".encode("utf-8")))' }
```

---

_[View the full topic](https://discuss.elastic.co/t/find-and-replace-to-a-unicode-string/252226)._
