glib/gutf8.c (g_get_charset) glib/gconvert.c (g_locale_from_utf8) Clarify
authorTor Lillqvist <tml@novell.com>
Thu, 21 Feb 2008 13:07:49 +0000 (13:07 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 21 Feb 2008 13:07:49 +0000 (13:07 +0000)
2008-02-21  Tor Lillqvist  <tml@novell.com>

* glib/gutf8.c (g_get_charset)
* glib/gconvert.c (g_locale_from_utf8)
* docs/reference/glib/running.sgml: Clarify character set
issues on Windows.

svn path=/trunk/; revision=6551

ChangeLog
docs/reference/ChangeLog
docs/reference/glib/running.sgml
glib/gconvert.c
glib/gutf8.c

index f246840bf55aa3829aee08cc6f8b77b612d55ef4..09f20ba5054cb414a3ced91a847b972aa93b6826 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-21  Tor Lillqvist  <tml@novell.com>
+       
+       * glib/gutf8.c (g_get_charset)
+       * glib/gconvert.c (g_locale_from_utf8): Clarify character set
+       issues on Windows.
+
 2008-02-20  Tor Lillqvist  <tml@novell.com>
 
        * glib/gtestutils.c (g_test_trap_fork) [Win32]: Change the
index 35dc6fd89d887b820f1b1b3af3c3f06052de2e89..08be3c0a9a353a052d91de3983e83d8fa7eb28f5 100644 (file)
@@ -1,3 +1,7 @@
+2008-02-21  Tor Lillqvist  <tml@novell.com>
+
+       * glib/running.sgml: Clarify character set issues on Windows.
+
 2008-02-13  Ryan Lortie  <desrt@desrt.ca>
 
         * gio/gio-sections.txt: add G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT
index a8952d2ee8ac77c57ac6aa2fa2060df81202336d..c4060c25065888007d0ccee5b4e70e09ec73959d 100644 (file)
@@ -214,6 +214,22 @@ call <function>setlocale (LC_ALL, "")</function> to set up the current
 locale.
 </para>
 
+<para>
+On Windows, in a C program there are several locale concepts
+that not necessarily are synchronized. On one hand, there is the
+system default ANSI code-page, which determines what encoding is used
+for file names handled by the C library's functions and the Win32
+API. (We are talking about the "narrow" functions here that take
+character pointers, not the "wide" ones.)
+</para>
+
+<para>
+On the other hand, there is the C library's current locale. The
+character set (code-page) used by that is not necessarily the same as
+the system default ANSI code-page. Strings in this character set are
+returned by functions like <function>strftime</function>.
+</para>
+
 </refsect2>
 
 <refsect2>
index 4a6f0109bffbd7c6fd2d683331026a023bd1e542..e6fd8bd2a13c4f473a8106fa85c51e7c7bf967f2 100644 (file)
@@ -1098,7 +1098,8 @@ g_locale_to_utf8 (const gchar  *opsysstring,
  * 
  * Converts a string from UTF-8 to the encoding used for strings by
  * the C runtime (usually the same as that used by the operating
- * system) in the <link linkend="setlocale">current locale</link>.
+ * system) in the <link linkend="setlocale">current locale</link>. On
+ * Windows this means the system codepage.
  * 
  * Return value: The converted string, or %NULL on an error.
  **/
index 2676c4188b0953053b1705fd0d7e18f0aae464ac..9e0d9554f4b9b5cf6069de7a16bc361a18722b57 100644 (file)
@@ -510,6 +510,12 @@ charset_cache_free (gpointer data)
  * other encoding. (Frequently g_locale_to_utf8() and g_locale_from_utf8()
  * are nice shortcuts, though.)
  *
+ * On Windows the character set returned by this function is the
+ * so-called system default ANSI code-page. That is the character set
+ * used by the "narrow" versions of C library and Win32 functions that
+ * handle file names. It might be different from the character set
+ * used by the C library's current locale.
+ *
  * The return value is %TRUE if the locale's encoding is UTF-8, in that
  * case you can perhaps avoid calling g_convert().
  *