diff options
author | Simon Howard | 2012-02-04 23:05:42 +0000 |
---|---|---|
committer | Simon Howard | 2012-02-04 23:05:42 +0000 |
commit | 920ffea9b631e712ff0826911db01a76edbe7521 (patch) | |
tree | f4fef93bde165c650a3a61ac8cee4a90876d7df1 /src/net_client.c | |
parent | c6b8f1163708db85251daac24b2ffa6bea24a72a (diff) | |
download | chocolate-doom-920ffea9b631e712ff0826911db01a76edbe7521.tar.gz chocolate-doom-920ffea9b631e712ff0826911db01a76edbe7521.tar.bz2 chocolate-doom-920ffea9b631e712ff0826911db01a76edbe7521.zip |
On Windows, convert the USER and USERNAME environment variables from OEM
codepage to UTF-8 encoding. This should fix the case where the user has
a username that includes non-ASCII characters (thanks Alexandre Xavier).
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2495
Diffstat (limited to 'src/net_client.c')
-rw-r--r-- | src/net_client.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/net_client.c b/src/net_client.c index e338362e..b3109ecd 100644 --- a/src/net_client.c +++ b/src/net_client.c @@ -33,6 +33,7 @@ #include "i_system.h" #include "i_timer.h" #include "m_argv.h" +#include "m_misc.h" #include "net_client.h" #include "net_common.h" #include "net_defs.h" @@ -1273,6 +1274,17 @@ void NET_CL_Init(void) net_player_name = getenv("USER"); if (net_player_name == NULL) net_player_name = getenv("USERNAME"); + + // On Windows, environment variables are in OEM codepage + // encoding, so convert to UTF8: + +#ifdef _WIN32 + if (net_player_name != NULL) + { + net_player_name = M_OEMToUTF8(net_player_name); + } +#endif + if (net_player_name == NULL) net_player_name = "Player"; } |