The php Function mb_Convert_Encoding
The php function mb_convert_encoding converts a string from one character encoding to another. The function takes in three parameters: the string to convert, the encoding to convert to and the encoding from which to convert. The function can take in an array and recursively convert all strings within the array. The function will return the encoded string if successful, else it will return false.
This function is a very useful tool when working with web pages and databases that require you to convert text from different encodings. However, it can also lead to bugs and erroneous output if used incorrectly.
mb_convert_encoding allows characters to pass that would otherwise be rejected by other PHP functions, such as mb_check_encoding() and mb_detect_encoding(). This means that high Unicode code points outside of the Basic Multilingual Plane and characters composed of four or more bytes (such as hieroglyhps and cuneiform) can get through to your database or other web services. It also allows multi-byte sequences that exceed the maximum number of allowed bytes in a UTF-8 sequence (which is not the same as the total amount of bytes allowed for a string, see here).
The solution to this problem is to use mb_convert_encoding with the flag mb_multibyte enabled and with the option