Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2009 12:06:35 +0100 (CET)
From:      Marcin Cieslak <saper@SYSTEM.PL>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/130868: graphics/librsvg2: fix for locale bug in rsvg-convert
Message-ID:  <200901221106.n0MB6Ztg017745@radziecki.saper.info>
Resent-Message-ID: <200901221120.n0MBK1Qk078954@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         130868
>Category:       ports
>Synopsis:       graphics/librsvg2: fix for locale bug in rsvg-convert
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 22 11:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Marcin Cieslak
>Release:        FreeBSD 7.1-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD radziecki.saper.info 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0 r182840M: Sun Sep 7 22:50:12 CEST 2008 saper@radziecki.saper.info:/usr/obj/usr/src/sys/VAIO amd64

Please assign to gnome@

>Description:

rsvg-convert as released has an annoying bug:

Bug 557036 – rsvg-convert uses the wrong locale for command line processing

http://bugzilla.gnome.org/show_bug.cgi?id=557036

rsvg-convert refuses to work on UTF-8 filenames in the filesystem, regardless of the current locale.

Attached please find a simple patch to fix this.
Patch by Tim Starling of Wikimedia.

>How-To-Repeat:

Try to run rsvg-convert using UTF-8 filesnames.
The result:

Invalid byte sequence in conversion input

>Fix:

setlocale(3) should be called early at startup

--- rsvg-convert.c	2007-07-01 23:43:44.000000000 +1000
+++ rsvg-convert.c	2008-10-20 16:52:27.000000000 +1100
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <locale.h>
 
 #include "rsvg.h"
 #include "rsvg-cairo.h"
@@ -52,7 +53,7 @@
 display_error (GError * err)
 {
     if (err) {
-        g_print ("%s", err->message);
+        g_print ("%s\n", err->message);
         g_error_free (err);
     }
 }
@@ -165,6 +166,9 @@
         {NULL}
     };
 
+	/* Set the locale so that UTF-8 filenames work */
+	setlocale(LC_ALL, "");
+
 	g_thread_init(NULL);
 
     g_option_context = g_option_context_new (_("- SVG Converter"));
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901221106.n0MB6Ztg017745>