my exception code was too clever by half
This commit is contained in:
parent
fefb99bb33
commit
8e7225440a
@ -264,26 +264,27 @@ static bool checkDataConversionsProduceExpected(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool CheckForUtfEnvironment(void) {
|
static bool CheckForUtfEnvironment(void) {
|
||||||
ILogMessage("\tChecking for UTF locale. ☹");
|
ILogMessage("\tChecking for UTF locale. ☺");
|
||||||
try {
|
try {
|
||||||
bool utfEnvironment{ true };
|
bool utfEnvironment{ true };
|
||||||
|
std::string cum{};
|
||||||
if constexpr (b_WINDOWS) {
|
if constexpr (b_WINDOWS) {
|
||||||
auto ACP{ GetACP() };
|
auto ACP{ GetACP() };
|
||||||
// Check that windows thinks this is UTF8
|
// Check that windows thinks this is UTF8
|
||||||
utfEnvironment = utfEnvironment && (ACP == 65001);
|
utfEnvironment = utfEnvironment && (ACP == 65001);
|
||||||
if (!utfEnvironment) {
|
if (!utfEnvironment) {
|
||||||
szError = std::format("current code page {}, —should be 65001☹, ", ACP);
|
cum += std::format("current code page {}, —should be 65001☹, ", ACP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto FontEncoding{ wxLocale::GetSystemEncoding() };
|
auto FontEncoding{ wxLocale::GetSystemEncoding() };
|
||||||
// check that wxWidgets thinks this is UTF8
|
// check that wxWidgets thinks this is UTF8
|
||||||
utfEnvironment = utfEnvironment && (FontEncoding == wxFONTENCODING_UTF8);
|
utfEnvironment = utfEnvironment && (FontEncoding == wxFONTENCODING_UTF8);
|
||||||
if (!utfEnvironment) {
|
if (!utfEnvironment) {
|
||||||
szError += std::format("swxFontEncoding {}, – should be {} ☹",
|
cum += std::format("swxFontEncoding {}, —should be {} ☹",
|
||||||
(int)FontEncoding,
|
(int)FontEncoding,
|
||||||
(int)wxFONTENCODING_UTF8
|
(int)wxFONTENCODING_UTF8
|
||||||
);
|
);
|
||||||
throw MyException(szError, __LINE__, __func__, SrcFilename);
|
throw MyException(cum, __LINE__, __func__, SrcFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const MyException& e) {
|
catch (const MyException& e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user