[gnome-shell] Bug 587949 - Handle locale-encoded names from struct pwent



commit 8a56b990dd4ddedacf528710cc484b3c2d59f01f
Author: Colin Walters <walters verbum org>
Date:   Tue Jul 7 20:56:01 2009 -0400

    Bug 587949 - Handle locale-encoded names from struct pwent
    
    Convert to utf8 internally.

 src/gdmuser/gdm-user.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/gdmuser/gdm-user.c b/src/gdmuser/gdm-user.c
index ffd57f9..27bf8ec 100644
--- a/src/gdmuser/gdm-user.c
+++ b/src/gdmuser/gdm-user.c
@@ -412,13 +412,16 @@ _gdm_user_update (GdmUser             *user,
         /* Display Name */
         if (pwent->pw_gecos && pwent->pw_gecos[0] != '\0') {
                 gchar *first_comma;
+                gchar *real_name_utf8;
 
-                first_comma = strchr (pwent->pw_gecos, ',');
+                real_name_utf8 = g_locale_to_utf8 (pwent->pw_gecos, -1, NULL, NULL, NULL);
+
+                first_comma = strchr (real_name_utf8, ',');
                 if (first_comma) {
-                        real_name = g_strndup (pwent->pw_gecos,
-                                                  (first_comma - pwent->pw_gecos));
+                        real_name = g_strndup (real_name_utf8, first_comma - real_name_utf8);
+                        g_free (real_name_utf8);
                 } else {
-                        real_name = g_strdup (pwent->pw_gecos);
+                        real_name = real_name_utf8;
                 }
 
                 if (real_name[0] == '\0') {



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