.. _php-avoidmbdectectencoding: .. _avoid-mb\_dectect\_encoding(): Avoid mb_dectect_encoding() +++++++++++++++++++++++++++ mb_dectect_encoding() is bad at guessing encoding. For example, UTF-8 and ISO-8859-1 share some common characters : when a string is build with them it is impossible to differentiate the actual encoding. .. code-block:: php See also `mb_encoding_detect `_, `PHP vs. The Developer: Encoding Character Sets `_ and `DPC2019: Of representation and interpretation: A unified theory - Arnout Boks `_. Connex PHP features ------------------- + `mbstring `_ Suggestions ___________ * Store and transmit the data format Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Php/AvoidMbDectectEncoding | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.8.9 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+