Convenience function to read a string with unknown character encoding.
If the string is already in UTF-8 encoding, it will be returned right away. If not it tries to detect byte-order-mark for UTF-16/32 cases and
use that. Otherwise, the environment will be searched for a number of environment variables (whose names are specified in the NULL-terminated
env_vars) containing a list of character encodings to try/use. If none are specified, the current locale will be
tried. If that also doesn't work, WINDOWS-1252/ISO-8859-1 is assumed (which will almost always succeed).
a NULL-terminated string array of environment variable names, or NULL
length of string data, or -1 if the string is NUL-terminated
a newly-allocated string in UTF-8 encoding, or NULL