Can you explain how 8bit is encoded?

in the yii2 framework, you can see that when php communicates with redis through socket, the 8bit encoding is used to calculate the length of the string and intercept the returned information in the framework:

mb_strlen($arg, "8bit")

there is no description of this encoding in the document. When should I use this encoding? This coding method will not have a problem with Chinese coding?

Mar.07,2021

PHP supports mbstring.func_overload, to solve the problem that native substr cannot effectively deal with multibyte encoded strings

mbstring
supports a "function overload" function, which reloads the corresponding multi-byte version to the standard character handling function. For example, you can allow such applications to add multi-byte processing power without modifying the code.
for example, when function overloading is enabled, mb_substr () will be called instead of substr ().
in many cases this feature allows applications that only support single-byte encodings to be easily interfaced with multi-byte environments.

to use the function overloading function, set the mbstring.func_overload in php.ini to a positive value, which is the bitmask combination that is classified as the overloaded function.
to overload the mail () function, you need to set it to 1. The string function is set to 2 and the regular expression function is set to 4. For example, when it is set to 7, mail, strings, and regular expression functions will all be overloaded.

then the php runtime state is unknown in this case, so when calculating the character length, use mb_strlen 8bit to ensure the correctness of calculating the string length (according to 1byte = 8bit)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4261f-4c0b6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4261f-4c0b6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?