[glibmm] ustring docs: The global locale should be set when using C++ streams.



commit a22ac716b2eb169c1cdfbe7d1b500c590752965d
Author: Debarshi Ray <debarshir src gnome org>
Date:   Wed Nov 14 10:33:18 2012 +0100

    ustring docs: The global locale should be set when using C++ streams.
    
    * glib/glibmm/ustring.h: Replace output.imbue(std::locale("")) by
    std::locale::global(std::locale("")) in the description of how to use
    std::ostringstream. Bug #661588.

 ChangeLog             |    8 ++++++++
 glib/glibmm/ustring.h |    4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 76e5e60..0bc5654 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-14  Debarshi Ray  <debarshir src gnome org>
+
+	ustring docs: The global locale should be set when using C++ streams.
+
+	* glib/glibmm/ustring.h: Replace output.imbue(std::locale("")) by
+	std::locale::global(std::locale("")) in the description of how to use
+	std::ostringstream. Bug #661588.
+
 2012-11-13  Josà Alburquerque  <jaalburquerque gmail com>
 
 	giomm: Add the TlsPassword class.
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index 1780383..f0fa217 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -165,14 +165,14 @@ gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_P
  * @par
  * The stream I/O operators, that is operator<<() and operator>>(), perform
  * implicit charset conversion to/from the current locale.  If that's not
- * what you intented (e.g. when writing to a configuration file that should
+ * what you intended (e.g. when writing to a configuration file that should
  * always be UTF-8 encoded) use ustring::raw() to override this behaviour.
  * @par
  * If you're using std::ostringstream to build strings for display in the
  * user interface, you must convert the result back to UTF-8 as shown below:
  * @code
+ * std::locale::global(std::locale("")); // set the global locale to the user's preferred locale
  * std::ostringstream output;
- * output.imbue(std::locale("")); // use the user's locale for this stream
  * output << percentage << " % done";
  * label->set_text(Glib::locale_to_utf8(output.str()));
  * @endcode



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]