T
T
Troodi Larson2019-11-12 11:49:56
linux
Troodi Larson, 2019-11-12 11:49:56

Different strlen length on different machines?

Good afternoon. I can't figure out what's wrong with the config.
On the local machine: On the server: While the php.ini configurations are the same. I know about mb_string, but you can't throw out code from someone else's product. Where can you look? Maybe there should be some language packs in the system? Why does it consider multibytes in one case, but not in the other? Moreover, on version php 5.6 there is no such problem, but on 7.3 there is. strlen("йцу") == 3
strlen("йцу") == 6

Answer the question

In order to leave comments, you need to log in

4 answer(s)
F
FanatPHP, 2019-11-12
@FanatPHP

As you correctly wrote in the comments, the scripts are saved in different encodings.
Despite the fact that you think that the encodings are the same, the facts that you can observe in reality indicate otherwise.
Learn to trust the facts, not your fantasies. A very important quality for a programmer.
And learn to be humble at the same time. If it seems to you that a terrible bug in PHP is to blame for your problems, then take a closer look. You will see a stupid typo in your code.

W
whiteblackness, 2019-11-12
@whiteblackness

different encodings.
On the local machine, you have a single-byte encoding (for example, Windows-1251)
On the server - most likely utf-8, and there a character can take from 1 to 4 bytes.

L
Lynn "Coffee Man", 2019-11-12
@Lynn

Maybe https://www.php.net/manual/en/mbstring.overload.php is enabled on the server ?

B
Boris Korobkov, 2019-11-12
@BorisKorobkov

For PHP5.6, https://www.php.net/manual/en/mbstring.installation.php is not installed , therefore ignoring https://www.php.net/manual/en/mbstring.overload.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question