I
I
Ivan2020-01-31 13:03:42
PHP
Ivan, 2020-01-31 13:03:42

How to change superscript encoding from UTF-8 in windows-1251 to php?

Good afternoon. I ask for help from connoisseurs and gurus in PHP, it would seem a banal question, but ....
The bottom line is that a UTF-8 encoded value - mm² flies to me via api.
You need to change the encoding to windows-1251.
It would seem that there is nothing easier, we take iconv and go ahead, but no, iconv does not return anything at all (if ² is removed, then the norm changes the encoding), why don't we give up, we take the second method mb_convert_encoding - as a result we get mm ?.
Replacing the question mark with a character in the desired encoding does not solve the problem, since there may not be a square, but a cube or degrees, etc.
Help who knows.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-01-31
@Letivan

No way.
in windows-1251 encoding approximately 200 characters
in UTF-8 - millions.
It is physically impossible to cram a million characters into 200.
Therefore, either stop using the cave encoding, or fence manual replacement for all unsupported characters, stupidly with a string replacement.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question