[gdm] Bug 588031 - Handle usernames from non-UTF8 locales
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Subject: [gdm] Bug 588031 - Handle usernames from non-UTF8 locales
- Date: Fri, 10 Jul 2009 19:22:38 +0000 (UTC)
commit 839a6a625581a82a5a7320b7b71d6ccd9f531edf
Author: Colin Walters <walters megatron localdomain>
Date: Fri Jul 10 11:22:18 2009 -0400
Bug 588031 - Handle usernames from non-UTF8 locales
gui/simple-greeter/gdm-user.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
index ffd57f9..27bf8ec 100644
--- a/gui/simple-greeter/gdm-user.c
+++ b/gui/simple-greeter/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]