Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Environment variables code page
Environment variables code page [message #22538] Sat, 25 July 2009 13:05 Go to previous message
Zbych is currently offline  Zbych
Messages: 326
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

 
Read Message
Read Message
Read Message
Read Message
Previous Topic: string filtering bug
Next Topic: GZDecompress bug
Goto Forum:
  


Current Time: Fri May 10 16:36:05 CEST 2024

Total time taken to generate the page: 0.02869 seconds