Package: yelp Version: 2.20.0-1 Severity: wishlist Tags: patch User: [EMAIL PROTECTED] Usertags: origin-ubuntu ubuntu-patch hardy
The attached patch uses a new facility provided by man-db 2.5.1 to recode manual pages to UTF-8 while reading them. This allows yelp's rendering code to work regardless of the source encoding of the manual page, without it having to have lots of logic duplicated from man-db to figure this out. (At present, yelp breaks in different ways depending on the source encoding; see e.g. http://lists.debian.org/debian-i18n/2007/10/msg00081.html.) This facility is specific to man-db, and so at present not suitable for upstream (without some kind of run-time logic to figure out whether the facility is available). See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=440420 https://bugs.launchpad.net/ubuntu/+source/yelp/+bug/154829 Thanks, -- Colin Watson [EMAIL PROTECTED]
diff -ru yelp-2.20.0.orig/debian/control yelp-2.20.0/debian/control --- yelp-2.20.0.orig/debian/control 2008-02-11 10:28:31.000000000 +0000 +++ yelp-2.20.0/debian/control 2008-02-11 10:27:53.000000000 +0000 @@ -32,7 +32,8 @@ ${misc:Depends}, gnome-doc-utils, docbook-xml (>= 4.1.2), - xml-core + xml-core, + man-db (>= 2.5.1-1) Recommends: ttf-dejavu Replaces: gman Description: Help browser for GNOME 2 diff -ru yelp-2.20.0.orig/src/yelp-man-parser.c yelp-2.20.0/src/yelp-man-parser.c --- yelp-2.20.0.orig/src/yelp-man-parser.c 2007-09-17 21:49:09.000000000 +0100 +++ yelp-2.20.0/src/yelp-man-parser.c 2008-02-11 10:27:31.000000000 +0000 @@ -99,12 +99,30 @@ { GError *errormsg = NULL; /*gchar *ptr = NULL;*/ + gchar **recode_argv; + gint recode_stdout_fd; g_return_val_if_fail (parser != NULL, NULL); g_return_val_if_fail (file != NULL, NULL); g_return_val_if_fail (encoding != NULL, NULL); - parser->channel = yelp_io_channel_new_file (file, NULL); + recode_argv = g_new (gchar *, 5); + recode_argv[0] = g_strdup ("man"); + recode_argv[1] = g_strdup ("--recode"); + recode_argv[2] = g_strdup ("UTF-8"); + recode_argv[3] = g_strdup (file); + recode_argv[4] = NULL; + if (g_spawn_async_with_pipes (NULL, recode_argv, NULL, + G_SPAWN_SEARCH_PATH | + G_SPAWN_STDERR_TO_DEV_NULL, + NULL, NULL, NULL, + NULL, &recode_stdout_fd, NULL, + NULL)) { + parser->channel = g_io_channel_unix_new (recode_stdout_fd); + encoding = "UTF-8"; + } else + parser->channel = yelp_io_channel_new_file (file, NULL); + g_strfreev (recode_argv); if (!parser->channel) return NULL;