Date: Thursday, March 16, 2006 @ 18:24:25
  Author: marc
    Path: /cvsroot/carob/carob/src

Modified: Common.cpp (1.31 -> 1.32)

Now logging a very explicit error message when the UTF8 carob was compiled with 
is missing.


------------+
 Common.cpp |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletion(-)


Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.31 carob/src/Common.cpp:1.32
--- carob/src/Common.cpp:1.31   Thu Mar 16 15:13:06 2006
+++ carob/src/Common.cpp        Thu Mar 16 18:24:25 2006
@@ -182,10 +182,25 @@
   return result;
 }
 
+namespace {
+  using namespace CarobNS;
+  // this function just to log an explicit error message
+  std::locale tryUTF8locale()
+  {
+    try {
+      return trylocale(NAME_OF_ANY_UTF8_LOCALE_AVAILABLE);
+    } catch (CodecException& ce) {
+      logFatal(__WFILE__ L":tryUTF8locale()",
+               L"please install the missing UTF8 locale carob was configured 
with");
+      throw;
+    }
+  }
+}
+
 // init order matters here, since a failure to init utf8_codec will
 // call user_codec
 const CarobNS::MBSCodec CarobNS::StaticCodecs::user_codec;
-const CarobNS::MBSCodec 
CarobNS::StaticCodecs::utf8_codec(trylocale(NAME_OF_ANY_UTF8_LOCALE_AVAILABLE));
+const CarobNS::MBSCodec CarobNS::StaticCodecs::utf8_codec(tryUTF8locale());
 
 //Can this be factorized with ParameterStatement ?
 template <class T> wstring CarobNS::toWString(const T& t)
@@ -227,3 +242,11 @@
   }
   return src;
 }
+
+/*
+ * Local Variables:
+ * c-file-style: "bsd"
+ * c-basic-offset: 2
+ * indent-tabs-mode: nil
+ * End:
+ */

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to