Using the PHP Function mb_List_Encodings
PHP has many built-in functions, that can be used to perform specific tasks within a script. Besides the standard set of functions, it is possible to create your own custom functions as well. A function is a block of code that can be called at any time from within your script to execute the defined task.
The mb_list_encodings function returns an array of all supported encodings as a list, numerically indexed. This function is only available in PHP 5 and higher versions.
This function is a replacement for the old mb_encoding_aliases(), which is not compatible with PHP 7. The new function checks an encoding type for aliases and only returns those that are supported by mbstring. This is a very useful function, as it prevents you from trying to convert text to an encoding that is not supported by mbstring.
This tip is useful for anyone who works with Flash and PHP, storing Flash input submitted via an HTML form to a database or whatever. You might have noticed that mb_convert_encoding() fills the output with question marks whenever it encounters an unknown "from encoding" (e.g. iso-8859-1 -> utf-8).
The solution is to call the new function mb_list_encodings(), right after the Flash input field. It will return the correct encoding name for the mb_convert_encoding() to use in UTF-8 conversion. It will also prevent mb_convert_encoding() from changing the output encoding to whatever Windows 2000 happens to have installed, i.e. eucJP-win, iJIS-win or similar.