S
S
sema-fedotov2019-06-13 16:56:46
In contact with
sema-fedotov, 2019-06-13 16:56:46

Why are the sizes of different VK emoticons different?

Good afternoon, I'm making a bot for VK. There is functionality associated with emoticons. I need to be able to use only 1 emoji.

if (smile.length === 1) {
...
}

But for some emoticons it shows that they have 2 characters, or even all 4, for example, as a handshake emoticon. How can I make it so that 1 smiley is skipped?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2019-06-13
@sema-fedotov

Because emoticons are up to 4 bytes and utf8 mb4 encoding
https://stackoverflow.com/a/30074553/1603055
https://dev.to/coolgoose/quick-and-easy-way-of-cou...
https: //stackoverflow.com/a/25994411/1603055
Counting the length of strings in utf8 through length does not lead to the result that you expect.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question