From f85ce7f3872bd45fbe54a1de38f2e0b921b62f56 Mon Sep 17 00:00:00 2001 From: gustav_b Date: Wed, 1 Nov 2006 01:37:29 +0000 Subject: [PATCH] util/ucompose.hpp: catch exception thrown when user has an unsupported locale setting -- fallback to classic. --- src/util/ucompose.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/util/ucompose.hpp b/src/util/ucompose.hpp index d29cf5424..af5edbc85 100644 --- a/src/util/ucompose.hpp +++ b/src/util/ucompose.hpp @@ -182,7 +182,12 @@ namespace UStringPrivate : arg_no(1) { #if __GNUC__ >= 3 - os.imbue(std::locale("")); // use the user's locale for the stream + try { + os.imbue(std::locale("")); // use the user's locale for the stream + } + catch (std::runtime_error& e) { // fallback to classic if it failed + os.imbue(std::locale::classic()); + } #endif std::string::size_type b = 0, i = 0; -- 2.30.2