changeset 13075:4b7a8787432c

[gaim-migrate @ 15437] If the username in /etc/passwd is not utf8, don't write it to accounts.xml committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 30 Jan 2006 06:22:39 +0000
parents 27cd7d96a41a
children f3abb141042a
files src/protocols/bonjour/bonjour.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/bonjour/bonjour.c	Mon Jan 30 06:05:52 2006 +0000
+++ b/src/protocols/bonjour/bonjour.c	Mon Jan 30 06:22:39 2006 +0000
@@ -467,6 +467,15 @@
 	else
 		fullname = _("Gaim User");
 
+	/* Make sure fullname is valid UTF-8.  If not, try to convert it. */
+	if (!g_utf8_validate(fullname, -1, NULL))
+	{
+		gchar *tmp;
+		tmp = g_locale_to_utf8(fullname, -1, NULL, NULL, NULL);
+		if ((tmp == NULL) || (*tmp == '\0'))
+			fullname = _("Gaim User");
+	}
+
 #else
 	FARPROC myNetUserGetInfo = wgaim_find_and_loadproc("Netapi32.dll",
 		"NetUserGetInfo");