I
I
Igor2015-04-08 13:04:06
PHP
Igor, 2015-04-08 13:04:06

How to deal with characters from the extended utf-8 encoding in php?

The user writes a message that contains a rose (not supported here).
Further, after some manipulations in php, a serialized string arrives, which also contains the full text of the message.
This line is parsed by unserialize().
If the text contains characters from the utf-8 extension, then unserialize() returns false.
There are no problems with other icon symbols, for example: ☕ .
Tell me, how best to deal with characters from the extension?
Important condition: The project is a multilingual highload, so the solution should work even in Japanese.
PS When I first wrote this message, I tried to insert a rose here, but after it everything was cut off:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor, 2015-06-01
@KorroLion

As a result, I decided very simply: to remove from the string all characters that do not fall into the standard table by code number.

/[^\x{0000}-\x{FFFF}]/u

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question