← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~paul-lucas/zorba/pjl-misc into lp:zorba

 

Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/pjl-misc into lp:zorba.

Commit message:
Now explicitly specifying UTF-8 in locale name.

Requested reviews:
  Paul J. Lucas (paul-lucas)

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/155872

Now explicitly specifying UTF-8 in locale name.
-- 
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/155872
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/util/utf8_string.h'
--- src/util/utf8_string.h	2013-03-03 15:33:57 +0000
+++ src/util/utf8_string.h	2013-03-28 00:15:35 +0000
@@ -225,7 +225,7 @@
   typedef typename string_traits_type::std_string_arg std_string_arg;
   typedef typename string_traits_type::str_return_type str_return_type;
 
-  static size_type const npos = static_cast<size_type>( -1 );
+  static size_type const npos = StringType::npos;
 
   ////////// constructors & destructor ////////////////////////////////////////
 

=== modified file 'src/zorbautils/locale.cpp'
--- src/zorbautils/locale.cpp	2013-03-22 23:54:17 +0000
+++ src/zorbautils/locale.cpp	2013-03-28 00:15:35 +0000
@@ -261,9 +261,13 @@
     locale_name += '_';
     locale_name += iso3166_1::string_of[ country ];
   }
+  locale_name += ".UTF-8";
   locale_t loc = ::newlocale( LC_TIME_MASK, locale_name.c_str(), nullptr );
-  if ( !loc && country )                // try it without the country
-    loc = ::newlocale( LC_TIME_MASK, iso639_1::string_of[ lang ], nullptr );
+  if ( !loc && country ) {              // try it without the country
+    locale_name = iso639_1::string_of[ lang ];
+    locale_name += ".UTF-8";
+    loc = ::newlocale( LC_TIME_MASK, locale_name.c_str(), nullptr );
+  }
   return loc;
 }
 


Follow ups