Windows uses 16 bit wide characters to represent Unicode in the
process environment. Convert UTF-8 to UCS-2 and use the wide
character API to set environment variables.
Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
{
#if defined(WIN32)
{
- /*msg (M_INFO, "SetEnvironmentVariable '%s' '%s'", name_tmp, val_tmp ? val_tmp : "NULL");*/
- if (!SetEnvironmentVariable (name_tmp, val_tmp))
+ if (!SetEnvironmentVariableW (wide_string (name_tmp, &gc),
+ wide_string (val_tmp, &gc)))
msg (M_WARN | M_ERRNO, "SetEnvironmentVariable failed, name='%s', value='%s'",
name_tmp,
val_tmp ? val_tmp : "NULL");