char* gf_wcs_to_utf8(const wchar_t* str)
{
	size_t source_len;
	char* result;
	if (str == 0) return 0;
	source_len = wcslen(str);
	result = gf_calloc(source_len + 1, UTF8_MAX_BYTES_PER_CHAR);
	if (!result)
		return 0;
	if (gf_utf8_wcstombs(result, source_len * UTF8_MAX_BYTES_PER_CHAR, &str) == GF_UTF8_FAIL) {
		gf_free(result);
		return 0;
	}
	return result;
}
char* gf_wcs_to_utf8(const wchar_t* str)
{
	size_t source_len;
	char* result;
	if (str == 0) return 0;
	source_len = wcslen(str);
	result = gf_calloc(source_len + 1, UTF8_MAX_BYTES_PER_CHAR);
	if (!result)
		return 0;
	if (gf_utf8_wcstombs(result, source_len * UTF8_MAX_BYTES_PER_CHAR, &str) == GF_UTF8_FAIL) {
		gf_free(result);
		return 0;
	}
	return result;
}