aboutsummaryrefslogtreecommitdiffstats
path: root/examples/example6.cpp
diff options
context:
space:
mode:
authortholdawa <[email protected]>2014-01-16 18:51:51 +0000
committertholdawa <[email protected]>2014-01-16 18:51:51 +0000
commit280b2599308a491e12fbbac95d356358cf01abb9 (patch)
treea5255e92c0da2269bad1a8e6d38cd20f1c573e22 /examples/example6.cpp
parentC++11 std::shared_ptr fixes: (diff)
parentMerge pull request #65 from kisli/tholdawa-master (diff)
downloadvmime-280b2599308a491e12fbbac95d356358cf01abb9.tar.gz
vmime-280b2599308a491e12fbbac95d356358cf01abb9.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'examples/example6.cpp')
-rw-r--r--examples/example6.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/examples/example6.cpp b/examples/example6.cpp
index 30767c3e..54f1364b 100644
--- a/examples/example6.cpp
+++ b/examples/example6.cpp
@@ -25,6 +25,8 @@
#include <sstream>
#include <vector>
#include <map>
+#include <locale>
+#include <clocale>
#include "vmime/vmime.hpp"
#include "vmime/platforms/posix/posixHandler.hpp"
@@ -916,8 +918,16 @@ static bool menu()
int main()
{
- // VMime initialization
- vmime::platform::setHandler<vmime::platforms::posix::posixHandler>();
+ // Set the global C and C++ locale to the user-configured locale.
+ // The locale should use UTF-8 encoding for these tests to run successfully.
+ try
+ {
+ std::locale::global(std::locale(""));
+ }
+ catch (std::exception &)
+ {
+ std::setlocale(LC_ALL, "");
+ }
for (bool quit = false ; !quit ; )
{