Home » U++ Library support » U++ Core » Environment variables code page
Environment variables code page [message #22538] |
Sat, 25 July 2009 13:05  |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
Hi,
GetEnv function uses FromSystemCharset to convert code page, but environment variables in windows use OEM not ANSI code page. I think that there should be another function - FromOEMCharset (defined only in section PLATFORM_WIN32) and GetEnv should be split in two versions (windows and posix).
App.cpp, line ~10:
#ifdef PLATFORM_WIN32
String GetEnv(const char *id)
{
return FromOEMCharset(getenv(id));
}
[...]
App.cpp line ~20:
#ifdef PLATFORM_POSIX
String GetEnv(const char *id)
{
return FromSystemCharset(getenv(id));
}
[...]
Util.cpp line ~620:
String FromOEMCharset(const String& src)
{
WStringBuffer b(src.GetLength());
int q = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, ~src, src.GetLength(), (WCHAR*)~b, src.GetLength());
if(q <= 0)
return src;
b.SetCount(q);
return WString(b).ToString();
}
[Updated on: Sat, 25 July 2009 13:05] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 14 22:23:26 CEST 2025
Total time taken to generate the page: 0.02681 seconds
|