Code

util/ucompose.hpp: catch exception thrown when user has an unsupported
authorgustav_b <gustav_b@users.sourceforge.net>
Wed, 1 Nov 2006 01:37:29 +0000 (01:37 +0000)
committergustav_b <gustav_b@users.sourceforge.net>
Wed, 1 Nov 2006 01:37:29 +0000 (01:37 +0000)
locale setting -- fallback to classic.

src/util/ucompose.hpp

index d29cf5424f5d5ff69df1b91539060c5cd651463b..af5edbc859451f22fa267a34208d464a12b1d711 100644 (file)
@@ -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;