# Four byte characters not handled correctly by Word Delimiter Token Filter

**URL:** <https://discuss.elastic.co/t/four-byte-characters-not-handled-correctly-by-word-delimiter-token-filter/124202>\
**Category:** Elasticsearch\
**Created:** [March 16, 2018, 4:46am UTC](https://discuss.elastic.co/t/four-byte-characters-not-handled-correctly-by-word-delimiter-token-filter/124202 "2018-03-16T04:46:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daverino](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@Daverino](https://discuss.elastic.co/u/Daverino)\
**Post date:** [March 16, 2018, 4:46am UTC](https://discuss.elastic.co/t/four-byte-characters-not-handled-correctly-by-word-delimiter-token-filter/124202/1 "2018-03-16T04:46:27Z")

</div>

According to the docs, the Word Delimiter Token Filter should, by default, split on any non alpha-numeric character.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-word-delimiter-tokenfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-word-delimiter-tokenfilter.html)

However, I've found that the WDTF does not split when encountering a two character UTF-8 symbol, such as an emoji. I'd consider an emoji to be a non alpha-numeric character. In the case of one character UTF-8 emojis and symbols, the WDTF acts exactly as I would expect, and splits the token.

For example using UTF-8 0xF0 0x9F 0x98 0x82

```auto
/_analyze
{
	"tokenizer" : "whitespace",
	"filter" : ["word_delimiter"],
	"text" : "two character emo😂ji"
}

```

gives the output

```auto
{
    "tokens": [
        {
            "token": "two",
            "start_offset": 0,
            "end_offset": 3,
            "type": "word",
            "position": 0
        },
        {
            "token": "character",
            "start_offset": 4,
            "end_offset": 13,
            "type": "word",
            "position": 1
        },
        {
            "token": "emo😂ji",
            "start_offset": 14,
            "end_offset": 21,
            "type": "word",
            "position": 2
        }
    ]
}

```

Whereas using UTF-8 0xE2 0x9D 0xA4

```auto
/_analyze
{
	"tokenizer" : "whitespace",
	"filter" : ["word_delimiter"],
	"text" : "one character emo❤️ji"
}

```

gives me the results I would expect

```auto
{
    "tokens": [
        {
            "token": "one",
            "start_offset": 0,
            "end_offset": 3,
            "type": "word",
            "position": 0
        },
        {
            "token": "character",
            "start_offset": 4,
            "end_offset": 13,
            "type": "word",
            "position": 1
        },
        {
            "token": "emo",
            "start_offset": 14,
            "end_offset": 17,
            "type": "word",
            "position": 2
        },
        {
            "token": "️ji",
            "start_offset": 18,
            "end_offset": 21,
            "type": "word",
            "position": 3
        }
    ]
}

```

Is there a reason for why the first character in a two character emoji would be considered 'alpha-numeric' for purposes of the WDTF? As emojis are more and more common in text, this can give a really inconsistent result from ES.

---

<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:** [April 13, 2018, 4:46am UTC](https://discuss.elastic.co/t/four-byte-characters-not-handled-correctly-by-word-delimiter-token-filter/124202/2 "2018-04-13T04:46:34Z")

</div>

Closed on April 13, 2018, 4:46am UTC

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