tagFreeformStringToUtf8

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 string array 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).

string
tagFreeformStringToUtf8
(
string data
,
string[] envVars
)

Parameters

data string

string data

envVars string[]

a NULL-terminated string array of environment variable names, or NULL

Return Value

Type: string

a newly-allocated string in UTF-8 encoding, or NULL