Use LANG enviroment variable to select DOS-charset in unixes

This commit is contained in:
Stas Degteff 2007-02-04 08:31:32 +00:00
parent 05aad9af7b
commit 6a2d2e5ef8

View File

@ -28,6 +28,7 @@
#include <cstdlib>
#include <cstdio>
#include <clocale>
#include <stdlib.h>
#include <gcmpall.h>
#include <gstrall.h>
#ifdef __WIN32__
@ -113,6 +114,14 @@ const char *get_dos_charset(const char *cpfrom)
if(strieql(cpfrom, cpmap[i].from))
return cpmap[i].to;
}
#if defined(__unix__)
char* lang = getenv("LANG");
if( lang && strncmp(lang,"ru_RU",4) ) {
return "CP866";
}else{
return "CP437";
}
#endif
return "";
#endif
}