ports/130868: graphics/librsvg2: fix for locale bug in rsvg-convert

Marcin Cieslak saper at SYSTEM.PL
Thu Jan 22 11:20:02 UTC 2009

>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
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 22 11:20:01 UTC 2009
>Originator:     Marcin Cieslak
>Release:        FreeBSD 7.1-PRERELEASE amd64
System: FreeBSD radziecki.saper.info 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0 r182840M: Sun Sep 7 22:50:12 CEST 2008 saper at radziecki.saper.info:/usr/obj/usr/src/sys/VAIO amd64

Please assign to gnome@


rsvg-convert as released has an annoying bug:

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


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.


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

Invalid byte sequence in conversion input


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 @@
+	/* Set the locale so that UTF-8 filenames work */
+	setlocale(LC_ALL, "");
     g_option_context = g_option_context_new (_("- SVG Converter"));

More information about the freebsd-ports-bugs mailing list