Bug#306036: dia: Please include patch to fix locale changes when exporting to EPS and, SVG.

Hervé Cauwelier HervĂ© Cauwelier <hcauwelier@oursours.net>, 306036@bugs.debian.org
Sat, 23 Apr 2005 23:35:57 +0200


This is a multi-part message in MIME format.
--------------030007030609000809010601
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Package: dia
Severity: wishlist

You will find attached a dpatch made from CVS changes to fix exporting
decimal numbers.

-- System Information:
Debian Release: 3.1
   APT prefers unstable
   APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.10-1-386
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro (charmap=ANSI_X3.4-1968) 
(ignored: LC_ALL set to C)

-- 
Hervé Cauwelier
http://www.oursours.net/

--------------030007030609000809010601
Content-Type: text/plain;
 name="03_fix-locale-usage.dpatch"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="03_fix-locale-usage.dpatch"

#! /bin/sh /usr/share/dpatch/dpatch-run
## 03_fix-locale-usage.dpatch by Hervé Cauwelier <hcauwelier@oursours.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad dia-0.94.0/app/diapsft2renderer.c /tmp/dpep.5h0a8c/dia-0.94.0/app/diapsft2renderer.c
--- dia-0.94.0/app/diapsft2renderer.c	2005-04-23 22:52:34.061160456 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/app/diapsft2renderer.c	2005-04-23 22:52:34.934027760 +0200
@@ -278,6 +278,10 @@
   FT_Int load_flags = FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP;
   FT_Glyph glyph;
   FT_Error error;
+  gchar px_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar py_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar d1_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar d2_buf[G_ASCII_DTOSTR_BUF_SIZE];
 
   /* Need to transform */
 
@@ -297,8 +301,11 @@
   outline_info.OUT = renderer->file;
 
   fprintf(renderer->file, 
-	  "gsave %f %f translate %f %f scale\n",
-	  pos_x, pos_y, 2.54/72.0, -2.54/72.0);
+         "gsave %s %s translate %s %s scale\n",
+         g_ascii_formatd(px_buf, sizeof(px_buf), "%f", pos_x),
+         g_ascii_formatd(py_buf, sizeof(py_buf), "%f", pos_y),
+         g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", 2.54/72.0),
+         g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", -2.54/72.0) );
   fprintf(renderer->file, "start_ol\n");
 
   if ((error=FT_Load_Glyph(face, glyph_index, load_flags))) {
diff -urNad dia-0.94.0/app/diapsrenderer.c /tmp/dpep.5h0a8c/dia-0.94.0/app/diapsrenderer.c
--- dia-0.94.0/app/diapsrenderer.c	2005-04-23 22:52:34.063160152 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/app/diapsrenderer.c	2005-04-23 22:52:34.936027456 +0200
@@ -32,6 +32,10 @@
 #include "dia_image.h"
 #include "font.h"
 
+#define DTOSTR_BUF_SIZE G_ASCII_DTOSTR_BUF_SIZE
+#define psrenderer_dtostr(buf,d) \
+   g_ascii_formatd(buf, sizeof(buf), "%f", d)
+
 /* Returns TRUE if this file is an encapsulated postscript file
  * (including e.g. epsi).
  */
@@ -49,12 +53,16 @@
 lazy_setcolor(DiaPsRenderer *renderer,
               Color *color)
 {
+  gchar r_buf[DTOSTR_BUF_SIZE];
+  gchar g_buf[DTOSTR_BUF_SIZE];
+  gchar b_buf[DTOSTR_BUF_SIZE];
+
   if (!color_equals(color, &(renderer->lcolor))) {
     renderer->lcolor = *color;
-    fprintf(renderer->file, "%f %f %f srgb\n",
-            (double) color->red,
-            (double) color->green,
-            (double) color->blue);    
+    fprintf(renderer->file, "%s %s %s srgb\n",
+            psrenderer_dtostr(r_buf, (gdouble) color->red),
+            psrenderer_dtostr(g_buf, (gdouble) color->green),
+            psrenderer_dtostr(b_buf, (gdouble) color->blue) );    
   }
 }
 
@@ -126,12 +134,14 @@
 set_linewidth(DiaRenderer *self, real linewidth)
 {  /* 0 == hairline **/
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  gchar lw_buf[DTOSTR_BUF_SIZE];
 
   /* Adobe's advice:  Set to very small but fixed size, to avoid changes
    * due to different resolution output. */
   /* .01 cm becomes <5 dots on 1200 DPI */
   if (linewidth == 0.0) linewidth=.01;
-  fprintf(renderer->file, "%f slw\n", (double) linewidth);
+  fprintf(renderer->file, "%s slw\n",
+         psrenderer_dtostr(lw_buf, (gdouble) linewidth) );
 }
 
 static void
@@ -185,6 +195,9 @@
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
   real hole_width;
+  gchar dashl_buf[DTOSTR_BUF_SIZE];
+  gchar dotl_buf[DTOSTR_BUF_SIZE];
+  gchar holew_buf[DTOSTR_BUF_SIZE];
 
   renderer->saved_line_style = mode;
   
@@ -193,28 +206,36 @@
     fprintf(renderer->file, "[] 0 sd\n");
     break;
   case LINESTYLE_DASHED:
-    fprintf(renderer->file, "[%f] 0 sd\n", renderer->dash_length);
+    fprintf(renderer->file, "[%s] 0 sd\n",
+           psrenderer_dtostr(dashl_buf, renderer->dash_length) );
     break;
   case LINESTYLE_DASH_DOT:
     hole_width = (renderer->dash_length - renderer->dot_length) / 2.0;
-    fprintf(renderer->file, "[%f %f %f %f] 0 sd\n",
-	    renderer->dash_length,
-	    hole_width,
-	    renderer->dot_length,
-	    hole_width );
+    psrenderer_dtostr(holew_buf, hole_width);
+    psrenderer_dtostr(dashl_buf, renderer->dash_length);
+    psrenderer_dtostr(dotl_buf, renderer->dot_length);
+    fprintf(renderer->file, "[%s %s %s %s] 0 sd\n",
+           dashl_buf,
+           holew_buf,
+           dotl_buf,
+           holew_buf );
     break;
   case LINESTYLE_DASH_DOT_DOT:
     hole_width = (renderer->dash_length - 2.0*renderer->dot_length) / 3.0;
-    fprintf(renderer->file, "[%f %f %f %f %f %f] 0 sd\n",
-	    renderer->dash_length,
-	    hole_width,
-	    renderer->dot_length,
-	    hole_width,
-	    renderer->dot_length,
-	    hole_width );
+    psrenderer_dtostr(holew_buf, hole_width);
+    psrenderer_dtostr(dashl_buf, renderer->dash_length);
+    psrenderer_dtostr(dotl_buf, renderer->dot_length);
+    fprintf(renderer->file, "[%s %s %s %s %s %s] 0 sd\n",
+           dashl_buf,
+           holew_buf,
+           dotl_buf,
+           holew_buf,
+           dotl_buf,
+           holew_buf );
     break;
   case LINESTYLE_DOTTED:
-    fprintf(renderer->file, "[%f] 0 sd\n", renderer->dot_length);
+    fprintf(renderer->file, "[%s] 0 sd\n",
+           psrenderer_dtostr(dotl_buf, renderer->dot_length) );
     break;
   }
 }
@@ -251,9 +272,11 @@
 set_font(DiaRenderer *self, DiaFont *font, real height)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  gchar h_buf[DTOSTR_BUF_SIZE];
 
-  fprintf(renderer->file, "/%s-latin1 ff %f scf sf\n",
-          dia_font_get_psfontname(font), (double)height*0.7);
+  fprintf(renderer->file, "/%s-latin1 ff %s scf sf\n",
+          dia_font_get_psfontname(font),
+         psrenderer_dtostr(h_buf, (gdouble) height*0.7) );
 }
 
 static void
@@ -262,11 +285,18 @@
 	  Color *line_color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  gchar sx_buf[DTOSTR_BUF_SIZE];
+  gchar sy_buf[DTOSTR_BUF_SIZE];
+  gchar ex_buf[DTOSTR_BUF_SIZE];
+  gchar ey_buf[DTOSTR_BUF_SIZE];
 
   lazy_setcolor(renderer,line_color);
 
-  fprintf(renderer->file, "n %f %f m %f %f l s\n",
-	  start->x, start->y, end->x, end->y);
+  fprintf(renderer->file, "n %s %s m %s %s l s\n",
+         psrenderer_dtostr(sx_buf, start->x),
+         psrenderer_dtostr(sy_buf, start->y),
+         psrenderer_dtostr(ex_buf, end->x),
+         psrenderer_dtostr(ey_buf, end->y) );
 }
 
 static void
@@ -276,39 +306,60 @@
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
   int i;
+  gchar px_buf[DTOSTR_BUF_SIZE];
+  gchar py_buf[DTOSTR_BUF_SIZE];
 
   lazy_setcolor(renderer,line_color);
   
-  fprintf(renderer->file, "n %f %f m ",
-	  points[0].x, points[0].y);
+  fprintf(renderer->file, "n %s %s m ",
+         psrenderer_dtostr(px_buf, points[0].x),
+         psrenderer_dtostr(py_buf, points[0].y) );
 
   for (i=1;i<num_points;i++) {
-    fprintf(renderer->file, "%f %f l ",
-	  points[i].x, points[i].y);
+    fprintf(renderer->file, "%s %s l ",
+           psrenderer_dtostr(px_buf, points[i].x),
+           psrenderer_dtostr(py_buf, points[i].y) );
   }
 
   fprintf(renderer->file, "s\n");
 }
 
 static void
-draw_polygon(DiaRenderer *self, 
-	      Point *points, int num_points, 
-	      Color *line_color)
+psrenderer_polygon(DiaPsRenderer *renderer,
+                  Point *points,
+                  gint num_points,
+                  Color *line_color,
+                  gboolean filled)
 {
-  DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-  int i;
-  
-  lazy_setcolor(renderer,line_color);
-  
-  fprintf(renderer->file, "n %f %f m ",
-	  points[0].x, points[0].y);
+  gint i;
+  gchar px_buf[DTOSTR_BUF_SIZE];
+  gchar py_buf[DTOSTR_BUF_SIZE];
+
+  lazy_setcolor(renderer, line_color);
+
+  fprintf(renderer->file, "n %s %s m ",
+         psrenderer_dtostr(px_buf, points[0].x),
+         psrenderer_dtostr(py_buf, points[0].y) );
+
 
   for (i=1;i<num_points;i++) {
-    fprintf(renderer->file, "%f %f l ",
-	  points[i].x, points[i].y);
+    fprintf(renderer->file, "%s %s l ",
+           psrenderer_dtostr(px_buf, points[i].x),
+           psrenderer_dtostr(py_buf, points[i].y) );
   }
+  if (filled)
+    fprintf(renderer->file, "ef\n");
+  else
+    fprintf(renderer->file, "cp s\n");
+}
 
-  fprintf(renderer->file, "cp s\n");
+static void
+draw_polygon(DiaRenderer *self, 
+	      Point *points, int num_points, 
+	      Color *line_color)
+{
+  DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  psrenderer_polygon(renderer, points, num_points, line_color, FALSE);
 }
 
 static void
@@ -317,19 +368,34 @@
 	      Color *fill_color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-  int i;
+  psrenderer_polygon(renderer, points, num_points, fill_color, TRUE);
+}
 
-  lazy_setcolor(renderer,fill_color);
-  
-  fprintf(renderer->file, "n %f %f m ",
-	  points[0].x, points[0].y);
+static void
+psrenderer_rect(DiaPsRenderer *renderer,
+               Point *ul_corner,
+               Point *lr_corner,
+               Color *color,
+               gboolean filled)
+{
+  gchar ulx_buf[DTOSTR_BUF_SIZE];
+  gchar uly_buf[DTOSTR_BUF_SIZE];
+  gchar lrx_buf[DTOSTR_BUF_SIZE];
+  gchar lry_buf[DTOSTR_BUF_SIZE];
 
-  for (i=1;i<num_points;i++) {
-    fprintf(renderer->file, "%f %f l ",
-	  points[i].x, points[i].y);
-  }
+  lazy_setcolor(renderer,color);
 
-  fprintf(renderer->file, "ef\n");
+  psrenderer_dtostr(ulx_buf, (gdouble) ul_corner->x);
+  psrenderer_dtostr(uly_buf, (gdouble) ul_corner->y);
+  psrenderer_dtostr(lrx_buf, (gdouble) lr_corner->x);
+  psrenderer_dtostr(lry_buf, (gdouble) lr_corner->y);
+  
+  fprintf(renderer->file, "n %s %s m %s %s l %s %s l %s %s l %s\n",
+         ulx_buf, uly_buf,
+         ulx_buf, lry_buf,
+         lrx_buf, lry_buf,
+         lrx_buf, uly_buf,
+         filled ? "f" : "cp s" );
 }
 
 static void
@@ -338,14 +404,7 @@
 	  Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-
-  lazy_setcolor(renderer,color);
-  
-  fprintf(renderer->file, "n %f %f m %f %f l %f %f l %f %f l cp s\n",
-	  (double) ul_corner->x, (double) ul_corner->y,
-	  (double) ul_corner->x, (double) lr_corner->y,
-	  (double) lr_corner->x, (double) lr_corner->y,
-	  (double) lr_corner->x, (double) ul_corner->y );
+  psrenderer_rect(renderer, ul_corner, lr_corner, color, FALSE);
 }
 
 static void
@@ -354,31 +413,53 @@
 	  Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  psrenderer_rect(renderer, ul_corner, lr_corner, color, TRUE);
+}
 
-  lazy_setcolor(renderer,color);
+static void
+psrenderer_arc(DiaPsRenderer *renderer,
+              Point *center,
+              real width, real height,
+              real angle1, real angle2,
+              Color *color,
+              gboolean filled)
+{
+  gchar cx_buf[DTOSTR_BUF_SIZE];
+  gchar cy_buf[DTOSTR_BUF_SIZE];
+  gchar a1_buf[DTOSTR_BUF_SIZE];
+  gchar a2_buf[DTOSTR_BUF_SIZE];
+  gchar w_buf[DTOSTR_BUF_SIZE];
+  gchar h_buf[DTOSTR_BUF_SIZE];
 
-  fprintf(renderer->file, "n %f %f m %f %f l %f %f l %f %f l f\n",
-	  (double) ul_corner->x, (double) ul_corner->y,
-	  (double) ul_corner->x, (double) lr_corner->y,
-	  (double) lr_corner->x, (double) lr_corner->y,
-	  (double) lr_corner->x, (double) ul_corner->y );
+  lazy_setcolor(renderer, color);
+
+  psrenderer_dtostr(cx_buf, (gdouble) center->x);
+  psrenderer_dtostr(cy_buf, (gdouble) center->y);
+  psrenderer_dtostr(a1_buf, (gdouble) 360.0 - angle1);
+  psrenderer_dtostr(a2_buf, (gdouble) 360.0 - angle2);
+  psrenderer_dtostr(w_buf, (gdouble) width / 2.0);
+  psrenderer_dtostr(h_buf, (gdouble) height / 2.0);
+
+  fprintf(renderer->file, "n ");
+
+  if (filled)
+    fprintf(renderer->file, "%s %s m ", cx_buf, cy_buf);
+
+  fprintf(renderer->file, "%s %s %s %s %s %s ellipse %s\n",
+         cx_buf, cy_buf, w_buf, h_buf, a2_buf, a1_buf,
+         filled ? "f" : "s" );
 }
 
+
 static void
-draw_arc(DiaRenderer *self, 
+draw_arc(DiaRenderer *self,
 	 Point *center,
 	 real width, real height,
 	 real angle1, real angle2,
 	 Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-
-  lazy_setcolor(renderer,color);
-
-  fprintf(renderer->file, "n %f %f %f %f %f %f ellipse s\n",
-	  (double) center->x, (double) center->y,
-	  (double) width/2.0, (double) height/2.0,
-	  (double) 360.0 - angle2, (double) 360.0 - angle1 );
+  psrenderer_arc(renderer, center, width, height, angle1, angle2, color, FALSE);
 }
 
 static void
@@ -389,14 +470,29 @@
 	 Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  psrenderer_arc(renderer, center, width, height, angle1, angle2, color, TRUE);
+}
 
+static void
+psrenderer_ellipse(DiaPsRenderer *renderer,
+                  Point *center,
+                  real width, real height,
+                  Color *color,
+                  gboolean filled)
+{
+  gchar cx_buf[DTOSTR_BUF_SIZE];
+  gchar cy_buf[DTOSTR_BUF_SIZE];
+  gchar w_buf[DTOSTR_BUF_SIZE];
+  gchar h_buf[DTOSTR_BUF_SIZE];
+  
   lazy_setcolor(renderer,color);
 
-  fprintf(renderer->file, "n %f %f m %f %f %f %f %f %f ellipse f\n",
-	  (double) center->x, (double) center->y,
-	  (double) center->x, (double) center->y,
-	  (double) width/2.0, (double) height/2.0,
-	  (double) 360.0 - angle2, (double) 360.0 - angle1 );
+  fprintf(renderer->file, "n %s %s %s %s 0 360 ellipse %s\n",
+         psrenderer_dtostr(cx_buf, (gdouble) center->x),
+         psrenderer_dtostr(cy_buf, (gdouble) center->y),
+         psrenderer_dtostr(w_buf, (gdouble) width / 2.0),
+         psrenderer_dtostr(h_buf, (gdouble) height / 2.0),
+         filled ? "f" : "cp s" );
 }
 
 static void
@@ -406,12 +502,7 @@
 	     Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-
-  lazy_setcolor(renderer,color);
-
-  fprintf(renderer->file, "n %f %f %f %f 0 360 ellipse cp s\n",
-	  (double) center->x, (double) center->y,
-	  (double) width/2.0, (double) height/2.0 );
+  psrenderer_ellipse(renderer, center, width, height, color, FALSE);
 }
 
 static void
@@ -421,30 +512,32 @@
 	     Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-
-  lazy_setcolor(renderer,color);
-
-  fprintf(renderer->file, "n %f %f %f %f 0 360 ellipse f\n",
-	  (double) center->x, (double) center->y,
-	  (double) width/2.0, (double) height/2.0 );
+  psrenderer_ellipse(renderer, center, width, height, color, TRUE);
 }
 
 static void
-draw_bezier(DiaRenderer *self, 
-	    BezPoint *points,
-	    int numpoints, /* numpoints = 4+3*n, n=>0 */
-	    Color *color)
+psrenderer_bezier(DiaPsRenderer *renderer,
+                 BezPoint *points,
+                 gint numpoints,
+                 Color *color,
+                 gboolean filled)
 {
-  DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-  int i;
+  gint  i;
+  gchar p1x_buf[DTOSTR_BUF_SIZE];
+  gchar p1y_buf[DTOSTR_BUF_SIZE];
+  gchar p2x_buf[DTOSTR_BUF_SIZE];
+  gchar p2y_buf[DTOSTR_BUF_SIZE];
+  gchar p3x_buf[DTOSTR_BUF_SIZE];
+  gchar p3y_buf[DTOSTR_BUF_SIZE];
 
   lazy_setcolor(renderer,color);
 
   if (points[0].type != BEZ_MOVE_TO)
     g_warning("first BezPoint must be a BEZ_MOVE_TO");
 
-  fprintf(renderer->file, "n %f %f m",
-	  (double) points[0].p1.x, (double) points[0].p1.y);
+  fprintf(renderer->file, "n %s %s m",
+         psrenderer_dtostr(p1x_buf, (gdouble) points[0].p1.x),
+         psrenderer_dtostr(p1y_buf, (gdouble) points[0].p1.y) );
   
   for (i = 1; i < numpoints; i++)
     switch (points[i].type) {
@@ -452,18 +545,35 @@
       g_warning("only first BezPoint can be a BEZ_MOVE_TO");
       break;
     case BEZ_LINE_TO:
-      fprintf(renderer->file, " %f %f l",
-	      (double) points[i].p1.x, (double) points[i].p1.y);
+      fprintf(renderer->file, " %s %s l",
+             psrenderer_dtostr(p1x_buf, (gdouble) points[i].p1.x),
+             psrenderer_dtostr(p1y_buf, (gdouble) points[i].p1.y) );
       break;
     case BEZ_CURVE_TO:
-      fprintf(renderer->file, " %f %f %f %f %f %f c",
-	      (double) points[i].p1.x, (double) points[i].p1.y,
-	      (double) points[i].p2.x, (double) points[i].p2.y,
-	      (double) points[i].p3.x, (double) points[i].p3.y );
+      fprintf(renderer->file, " %s %s %s %s %s %s c",
+             psrenderer_dtostr(p1x_buf, (gdouble) points[i].p1.x),
+             psrenderer_dtostr(p1y_buf, (gdouble) points[i].p1.y),
+             psrenderer_dtostr(p2x_buf, (gdouble) points[i].p2.x),
+             psrenderer_dtostr(p2y_buf, (gdouble) points[i].p2.y),
+             psrenderer_dtostr(p3x_buf, (gdouble) points[i].p3.x),
+             psrenderer_dtostr(p3y_buf, (gdouble) points[i].p3.y) );
       break;
     }
 
-  fprintf(renderer->file, " s\n");
+  if (filled)
+    fprintf(renderer->file, " ef\n");
+  else
+    fprintf(renderer->file, " s\n");
+}
+
+static void
+draw_bezier(DiaRenderer *self, 
+           BezPoint *points,
+           int numpoints, /* numpoints = 4+3*n, n=>0 */
+           Color *color)
+{
+  DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
+  psrenderer_bezier(renderer, points, numpoints, color, FALSE);
 }
 
 static void
@@ -473,34 +583,7 @@
 	    Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-  int i;
-
-  lazy_setcolor(renderer,color);
-
-  if (points[0].type != BEZ_MOVE_TO)
-    g_warning("first BezPoint must be a BEZ_MOVE_TO");
-
-  fprintf(renderer->file, "n %f %f m",
-	  (double) points[0].p1.x, (double) points[0].p1.y);
-  
-  for (i = 1; i < numpoints; i++)
-    switch (points[i].type) {
-    case BEZ_MOVE_TO:
-      g_warning("only first BezPoint can be a BEZ_MOVE_TO");
-      break;
-    case BEZ_LINE_TO:
-      fprintf(renderer->file, " %f %f l",
-	      (double) points[i].p1.x, (double) points[i].p1.y);
-      break;
-    case BEZ_CURVE_TO:
-      fprintf(renderer->file, " %f %f %f %f %f %f c",
-	      (double) points[i].p1.x, (double) points[i].p1.y,
-	      (double) points[i].p2.x, (double) points[i].p2.y,
-	      (double) points[i].p3.x, (double) points[i].p3.y );
-      break;
-    }
-
-  fprintf(renderer->file, " ef\n");
+  psrenderer_bezier(renderer, points, numpoints, color, TRUE);
 }
 
 static void
@@ -510,10 +593,12 @@
 	    Color *color)
 {
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
-  char *buffer;
-  const char *str;
-  int len;
+  gchar *buffer;
   gchar *localestr;
+  gchar px_buf[DTOSTR_BUF_SIZE];
+  gchar py_buf[DTOSTR_BUF_SIZE];
+  const gchar *str;
+  gint len;
   GError * error = NULL;
 
   if (1 > strlen(text))
@@ -550,15 +635,19 @@
 
   switch (alignment) {
   case ALIGN_LEFT:
-    fprintf(renderer->file, "%f %f m", pos->x, pos->y);
+    fprintf(renderer->file, "%s %s m",
+           psrenderer_dtostr(px_buf, pos->x),
+           psrenderer_dtostr(py_buf, pos->y) );
     break;
   case ALIGN_CENTER:
-    fprintf(renderer->file, "dup sw 2 div %f ex sub %f m",
-	    pos->x, pos->y);
+    fprintf(renderer->file, "dup sw 2 div %s ex sub %s m",
+           psrenderer_dtostr(px_buf, pos->x),
+           psrenderer_dtostr(py_buf, pos->y) );
     break;
   case ALIGN_RIGHT:
-    fprintf(renderer->file, "dup sw %f ex sub %f m",
-	    pos->x, pos->y);
+    fprintf(renderer->file, "dup sw %s ex sub %s m",
+           psrenderer_dtostr(px_buf, pos->x),
+           psrenderer_dtostr(py_buf, pos->y) );
     break;
   }
   
@@ -574,10 +663,12 @@
   DiaPsRenderer *renderer = DIA_PS_RENDERER(self);
   int img_width, img_height, img_rowstride;
   int v;
-  int                 x, y;
+  int x, y;
   real ratio;
   guint8 *rgb_data;
   guint8 *mask_data;
+  gchar d1_buf[DTOSTR_BUF_SIZE];
+  gchar d2_buf[DTOSTR_BUF_SIZE];
 
   img_width = dia_image_width(image);
   img_rowstride = dia_image_rowstride(image);
@@ -593,8 +684,12 @@
   /* color output only */
   fprintf(renderer->file, "/pix %i string def\n", img_width * 3);
   fprintf(renderer->file, "%i %i 8\n", img_width, img_height);
-  fprintf(renderer->file, "%f %f tr\n", point->x, point->y);
-  fprintf(renderer->file, "%f %f sc\n", width, height);
+  fprintf(renderer->file, "%s %s tr\n",
+                          psrenderer_dtostr(d1_buf, point->x),
+                          psrenderer_dtostr(d2_buf, point->y) );
+  fprintf(renderer->file, "%s %s sc\n",
+                          psrenderer_dtostr(d1_buf, width),
+                          psrenderer_dtostr(d2_buf, height) );
   fprintf(renderer->file, "[%i 0 0 %i 0 0]\n", img_width, img_height);
 
   fprintf(renderer->file, "{currentfile pix readhexstring pop}\n");
@@ -797,11 +892,18 @@
 static void
 end_prolog (DiaPsRenderer *renderer)
 {
+  gchar d1_buf[DTOSTR_BUF_SIZE];
+  gchar d2_buf[DTOSTR_BUF_SIZE];
+  
   if (renderer_is_eps(renderer)) {
     fprintf(renderer->file,
-            "%f %f scale\n", renderer->scale, -renderer->scale);
+            "%s %s scale\n",
+           psrenderer_dtostr(d1_buf, renderer->scale),
+           psrenderer_dtostr(d2_buf, -renderer->scale) );
     fprintf(renderer->file,
-            "%f %f translate\n", -renderer->extent.left, -renderer->extent.bottom);
+            "%s %s translate\n",
+           psrenderer_dtostr(d1_buf, -renderer->extent.left),
+           psrenderer_dtostr(d2_buf, -renderer->extent.bottom) );
   } else {
     /* done by BoundingBox above */
   }
diff -urNad dia-0.94.0/app/paginate_psprint.c /tmp/dpep.5h0a8c/dia-0.94.0/app/paginate_psprint.c
--- dia-0.94.0/app/paginate_psprint.c	2005-04-23 22:52:34.064160000 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/app/paginate_psprint.c	2005-04-23 22:52:34.936027456 +0200
@@ -24,7 +24,6 @@
 #endif
 
 #include <stdio.h>
-#include <locale.h>
 #include <string.h> /* strlen */
 #include <signal.h>
 #include <errno.h>
@@ -71,6 +70,8 @@
   gfloat tmargin = data->paper.tmargin, bmargin = data->paper.bmargin;
   gfloat lmargin = data->paper.lmargin;
   gfloat scale = data->paper.scaling;
+  gchar d1_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar d2_buf[G_ASCII_DTOSTR_BUF_SIZE];
 
   rend->paper = data->paper.name;
 
@@ -90,22 +91,38 @@
 
   /* transform coordinate system */
   if (data->paper.is_portrait) {
-    fprintf(rend->file, "%f %f scale\n", 28.346457*scale, -28.346457*scale);
-    fprintf(rend->file, "%f %f translate\n", lmargin/scale - bounds->left,
-	    -bmargin/scale - bounds->bottom);
+    fprintf(rend->file, "%s %s scale\n",
+           g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", 28.346457*scale),
+           g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", -28.346457*scale) );
+    fprintf(rend->file, "%s %s translate\n",
+           g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", lmargin/scale - bounds->left),
+           g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", -bmargin/scale - bounds->bottom) );
   } else {
     fprintf(rend->file, "90 rotate\n");
-    fprintf(rend->file, "%f %f scale\n", 28.346457*scale, -28.346457*scale);
-    fprintf(rend->file, "%f %f translate\n", lmargin/scale - bounds->left,
-	    tmargin/scale - bounds->top);
+    fprintf(rend->file, "%s %s scale\n",
+           g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", 28.346457*scale),
+           g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", -28.346457*scale) );
+    fprintf(rend->file, "%s %s translate\n",
+           g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", lmargin/scale - bounds->left),
+           g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", tmargin/scale - bounds->top) );
   }
 
   /* set up clip mask */
-  fprintf(rend->file, "n %f %f m ", bounds->left, bounds->top);
-  fprintf(rend->file, "%f %f l ", bounds->right, bounds->top);
-  fprintf(rend->file, "%f %f l ", bounds->right, bounds->bottom);
-  fprintf(rend->file, "%f %f l ", bounds->left, bounds->bottom);
-  fprintf(rend->file, "%f %f l ", bounds->left, bounds->top);
+  fprintf(rend->file, "n %s %s m ",
+         g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", bounds->left),
+         g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", bounds->top) );
+  fprintf(rend->file, "%s %s l ",
+         g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", bounds->right),
+         g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", bounds->top) );
+  fprintf(rend->file, "%s %s l ",
+         g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", bounds->right),
+         g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", bounds->bottom) );
+  fprintf(rend->file, "%s %s l ",
+         g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", bounds->left),
+         g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", bounds->bottom) );
+  fprintf(rend->file, "%s %s l ",
+         g_ascii_formatd(d1_buf, sizeof(d1_buf), "%f", bounds->left),
+         g_ascii_formatd(d2_buf, sizeof(d2_buf), "%f", bounds->top) );
   /* Tip from Dov Grobgeld: Clip does not destroy the path, so we should
      do a newpath afterwards */
   fprintf(rend->file, "clip n\n"); 
diff -urNad dia-0.94.0/lib/diasvgrenderer.c /tmp/dpep.5h0a8c/dia-0.94.0/lib/diasvgrenderer.c
--- dia-0.94.0/lib/diasvgrenderer.c	2005-04-23 22:52:34.065159848 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/lib/diasvgrenderer.c	2005-04-23 22:53:09.347796072 +0200
@@ -34,7 +34,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <locale.h>
 
 #include <libxml/entities.h>
 #include <libxml/tree.h>
@@ -48,6 +47,10 @@
 
 #include "diasvgrenderer.h"
 
+#define DTOSTR_BUF_SIZE G_ASCII_DTOSTR_BUF_SIZE
+#define dia_svg_dtostr(buf,d) \
+       g_ascii_formatd(buf,sizeof(buf),"%g",d)
+
 /* DiaSvgRenderer methods */
 static void
 begin_render(DiaRenderer *self)
@@ -128,44 +131,58 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   real hole_width;
-  char *old_locale;
+  gchar dash_length_buf[DTOSTR_BUF_SIZE];
+  gchar dot_length_buf[DTOSTR_BUF_SIZE];
+  gchar hole_width_buf[DTOSTR_BUF_SIZE];
 
   renderer->saved_line_style = mode;
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   g_free(renderer->linestyle);
   switch(mode) {
   case LINESTYLE_SOLID:
     renderer->linestyle = NULL;
     break;
   case LINESTYLE_DASHED:
-    renderer->linestyle = g_strdup_printf("%g", renderer->dash_length);
+    dia_svg_dtostr(dash_length_buf, renderer->dash_length);
+    renderer->linestyle = g_strdup_printf("%s", dash_length_buf);
     break;
   case LINESTYLE_DASH_DOT:
     hole_width = (renderer->dash_length - renderer->dot_length) / 2.0;
-    renderer->linestyle = g_strdup_printf("%g %g %g %g",
-					  renderer->dash_length,
-					  hole_width,
-					  renderer->dot_length,
-					  hole_width);
+
+    dia_svg_dtostr(dash_length_buf, renderer->dash_length);
+    dia_svg_dtostr(dot_length_buf, renderer->dot_length);
+    dia_svg_dtostr(hole_width_buf, hole_width);
+
+    renderer->linestyle = g_strdup_printf("%s %s %s %s",
+                                         dash_length_buf,
+                                         hole_width_buf,
+                                         dot_length_buf,
+                                         hole_width_buf );
     break;
   case LINESTYLE_DASH_DOT_DOT:
     hole_width = (renderer->dash_length - 2.0*renderer->dot_length) / 3.0;
-    renderer->linestyle = g_strdup_printf("%g %g %g %g %g %g",
-					  renderer->dash_length,
-					  hole_width,
-					  renderer->dot_length,
-					  hole_width,
-					  renderer->dot_length,
-					  hole_width );
+
+    dia_svg_dtostr(dash_length_buf, renderer->dash_length);
+    dia_svg_dtostr(dot_length_buf, renderer->dot_length);
+    dia_svg_dtostr(hole_width_buf, hole_width);
+
+    renderer->linestyle = g_strdup_printf("%s %s %s %s %s %s",
+                                         dash_length_buf,
+                                         hole_width_buf,
+                                         dot_length_buf,
+                                         hole_width_buf,
+                                         dot_length_buf,
+                                         hole_width_buf );
     break;
   case LINESTYLE_DOTTED:
-    renderer->linestyle = g_strdup_printf("%g", renderer->dot_length);
+
+    dia_svg_dtostr(dot_length_buf, renderer->dot_length);
+
+    renderer->linestyle = g_strdup_printf("%s", dot_length_buf);
     break;
   default:
     renderer->linestyle = NULL;
   }
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -199,15 +216,13 @@
 	       Color *colour)
 {
   static GString *str = NULL;
-  char *old_locale;
+  gchar linewidth_buf[DTOSTR_BUF_SIZE];
 
   if (!str) str = g_string_new(NULL);
   g_string_truncate(str, 0);
 
   /* TODO(CHECK): the shape-export didn't have 'fill: none' here */
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_string_sprintf(str, "fill: none; fill-opacity:0; stroke-width: %g", renderer->linewidth);
-  setlocale(LC_NUMERIC, old_locale);
+  g_string_sprintf(str, "fill: none; fill-opacity:0; stroke-width: %s", dia_svg_dtostr(linewidth_buf, renderer->linewidth) );
   if (strcmp(renderer->linecap, "butt"))
     g_string_sprintfa(str, "; stroke-linecap: %s", renderer->linecap);
   if (strcmp(renderer->linejoin, "miter"))
@@ -246,23 +261,20 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "line", NULL);
 
   xmlSetProp(node, "style", get_draw_style(renderer, line_colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", start->x);
-  xmlSetProp(node, "x1", buf);
-  g_snprintf(buf, sizeof(buf), "%g", start->y);
-  xmlSetProp(node, "y1", buf);
-  g_snprintf(buf, sizeof(buf), "%g", end->x);
-  xmlSetProp(node, "x2", buf);
-  g_snprintf(buf, sizeof(buf), "%g", end->y);
-  xmlSetProp(node, "y2", buf);
-  setlocale(LC_NUMERIC, old_locale);
+  dia_svg_dtostr(d_buf, start->x);
+  xmlSetProp(node, "x1", d_buf);
+  dia_svg_dtostr(d_buf, start->y);
+  xmlSetProp(node, "y1", d_buf);
+  dia_svg_dtostr(d_buf, end->x);
+  xmlSetProp(node, "x2", d_buf);
+  dia_svg_dtostr(d_buf, end->y);
+  xmlSetProp(node, "y2", d_buf);
 }
 
 static void
@@ -274,19 +286,20 @@
   int i;
   xmlNodePtr node;
   GString *str;
-  char *old_locale;
+  gchar px_buf[DTOSTR_BUF_SIZE];
+  gchar py_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "polyline", NULL);
   
   xmlSetProp(node, "style", get_draw_style(renderer, line_colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   str = g_string_new(NULL);
   for (i = 0; i < num_points; i++)
-    g_string_sprintfa(str, "%g,%g ", points[i].x, points[i].y);
+    g_string_sprintfa(str, "%s,%s ",
+                     dia_svg_dtostr(px_buf, points[i].x),
+                     dia_svg_dtostr(py_buf, points[i].y) );
   xmlSetProp(node, "points", str->str);
   g_string_free(str, TRUE);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -298,19 +311,20 @@
   int i;
   xmlNodePtr node;
   GString *str;
-  char *old_locale;
+  gchar px_buf[DTOSTR_BUF_SIZE];
+  gchar py_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "polygon", NULL);
   
   xmlSetProp(node, "style", get_draw_style(renderer, line_colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   str = g_string_new(NULL);
   for (i = 0; i < num_points; i++)
-    g_string_sprintfa(str, "%g,%g ", points[i].x, points[i].y);
+    g_string_sprintfa(str, "%s,%s ",
+                     dia_svg_dtostr(px_buf, points[i].x),
+                     dia_svg_dtostr(py_buf, points[i].y) );
   xmlSetProp(node, "points", str->str);
   g_string_free(str, TRUE);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -322,19 +336,20 @@
   int i;
   xmlNodePtr node;
   GString *str;
-  char *old_locale;
+  gchar px_buf[DTOSTR_BUF_SIZE];
+  gchar py_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "polygon", NULL);
   
   xmlSetProp(node, "style", get_fill_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   str = g_string_new(NULL);
   for (i = 0; i < num_points; i++)
-    g_string_sprintfa(str, "%g,%g ", points[i].x, points[i].y);
+    g_string_sprintfa(str, "%s,%s ",
+                     dia_svg_dtostr(px_buf, points[i].x),
+                     dia_svg_dtostr(py_buf, points[i].y) );
   xmlSetProp(node, "points", str->str);
   g_string_free(str, TRUE);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -344,23 +359,20 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, NULL, "rect", NULL);
 
   xmlSetProp(node, "style", get_draw_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->x);
-  xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->y);
-  xmlSetProp(node, "y", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->x - ul_corner->x);
-  xmlSetProp(node, "width", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->y - ul_corner->y);
-  xmlSetProp(node, "height", buf);
-  setlocale(LC_NUMERIC, old_locale);
+  dia_svg_dtostr(d_buf, ul_corner->x);
+  xmlSetProp(node, "x", d_buf);
+  dia_svg_dtostr(d_buf, ul_corner->y);
+  xmlSetProp(node, "y", d_buf);
+  dia_svg_dtostr(d_buf, lr_corner->x - ul_corner->x);
+  xmlSetProp(node, "width", d_buf);
+  dia_svg_dtostr(d_buf, lr_corner->y - ul_corner->y);
+  xmlSetProp(node, "height", d_buf);
 }
 
 static void
@@ -370,23 +382,20 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "rect", NULL);
 
   xmlSetProp(node, "style", get_fill_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->x);
-  xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->y);
-  xmlSetProp(node, "y", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->x - ul_corner->x);
-  xmlSetProp(node, "width", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->y - ul_corner->y);
-  xmlSetProp(node, "height", buf);
-  setlocale(LC_NUMERIC, old_locale);
+  dia_svg_dtostr(d_buf, ul_corner->x);
+  xmlSetProp(node, "x", d_buf);
+  dia_svg_dtostr(d_buf, ul_corner->y);
+  xmlSetProp(node, "y", d_buf);
+  dia_svg_dtostr(d_buf, lr_corner->x - ul_corner->x);
+  xmlSetProp(node, "width", d_buf);
+  dia_svg_dtostr(d_buf, lr_corner->y - ul_corner->y);
+  xmlSetProp(node, "height", d_buf);
 }
 
 static int sweep (real x1,real y1,real x2,real y2,real x3,real y3)
@@ -419,7 +428,12 @@
   real y2=center->y - ry*sin(angle2*G_PI/180);
   int swp = sweep(x1,y1,x2,y2,center->x,center->y);
   int l_arc;
-  char *old_locale;
+  gchar x1_buf[DTOSTR_BUF_SIZE];
+  gchar y1_buf[DTOSTR_BUF_SIZE];
+  gchar rx_buf[DTOSTR_BUF_SIZE];
+  gchar ry_buf[DTOSTR_BUF_SIZE];
+  gchar x2_buf[DTOSTR_BUF_SIZE];
+  gchar y2_buf[DTOSTR_BUF_SIZE];
 
   if (angle2 > angle1) {
     l_arc = (angle2 - angle1) > 180;
@@ -435,14 +449,13 @@
   xmlSetProp(node, "style", get_draw_style(renderer, colour));
 
   /* this path might be incorrect ... */
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "M %g,%g A %g,%g 0 %d %d %g,%g",
-	     x1, y1,
-	     rx, ry,l_arc ,swp ,
-	     x2, y2);
+  g_snprintf(buf, sizeof(buf), "M %s,%s A %s,%s 0 %d %d %s,%s",
+            dia_svg_dtostr(x1_buf, x1), dia_svg_dtostr(y1_buf, y1),
+            dia_svg_dtostr(rx_buf, rx), dia_svg_dtostr(ry_buf, ry),
+            l_arc, swp,
+            dia_svg_dtostr(x2_buf, x2), dia_svg_dtostr(y2_buf, y2) );
 
   xmlSetProp(node, "d", buf);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -462,7 +475,14 @@
   real y2=center->y - ry*sin(angle2*G_PI/180);
   int swp = sweep(x1,y1,x2,y2,center->x,center->y);
   int l_arc;
-  char *old_locale;
+  gchar x1_buf[DTOSTR_BUF_SIZE];
+  gchar y1_buf[DTOSTR_BUF_SIZE];
+  gchar rx_buf[DTOSTR_BUF_SIZE];
+  gchar ry_buf[DTOSTR_BUF_SIZE];
+  gchar x2_buf[DTOSTR_BUF_SIZE];
+  gchar y2_buf[DTOSTR_BUF_SIZE];
+  gchar cx_buf[DTOSTR_BUF_SIZE];
+  gchar cy_buf[DTOSTR_BUF_SIZE];
 
   if (angle2 > angle1) {
     l_arc = (angle2 - angle1) > 180;
@@ -478,15 +498,15 @@
   xmlSetProp(node, "style", get_fill_style(renderer, colour));
 
   /* this path might be incorrect ... */
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "M %g,%g A %g,%g 0 %d %d %g,%g L %g,%g z",
-	     x1, y1,
-	     rx, ry,l_arc ,swp ,
-	     x2, y2,
-	     center->x, center->y);
+  g_snprintf(buf, sizeof(buf), "M %s,%s A %s,%s 0 %d %d %s,%s L %s,%s z",
+            dia_svg_dtostr(x1_buf, x1), dia_svg_dtostr(y2_buf, y2),
+            dia_svg_dtostr(rx_buf, rx), dia_svg_dtostr(ry_buf, ry),
+            l_arc, swp,
+            dia_svg_dtostr(x2_buf, x2), dia_svg_dtostr(y2_buf, y2),
+            dia_svg_dtostr(cx_buf, center->x),
+            dia_svg_dtostr(cy_buf, center->y) );
 
   xmlSetProp(node, "d", buf);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -497,23 +517,20 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "ellipse", NULL);
 
   xmlSetProp(node, "style", get_draw_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", center->x);
-  xmlSetProp(node, "cx", buf);
-  g_snprintf(buf, sizeof(buf), "%g", center->y);
-  xmlSetProp(node, "cy", buf);
-  g_snprintf(buf, sizeof(buf), "%g", width / 2);
-  xmlSetProp(node, "rx", buf);
-  g_snprintf(buf, sizeof(buf), "%g", height / 2);
-  xmlSetProp(node, "ry", buf);
-  setlocale(LC_NUMERIC, old_locale);
+  dia_svg_dtostr(d_buf, center->x);
+  xmlSetProp(node, "cx", d_buf);
+  dia_svg_dtostr(d_buf, center->y);
+  xmlSetProp(node, "cy", d_buf);
+  dia_svg_dtostr(d_buf, width / 2);
+  xmlSetProp(node, "rx", d_buf);
+  dia_svg_dtostr(d_buf, height / 2);
+  xmlSetProp(node, "ry", d_buf);
 }
 
 static void
@@ -524,23 +541,20 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "ellipse", NULL);
 
   xmlSetProp(node, "style", get_fill_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", center->x);
-  xmlSetProp(node, "cx", buf);
-  g_snprintf(buf, sizeof(buf), "%g", center->y);
-  xmlSetProp(node, "cy", buf);
-  g_snprintf(buf, sizeof(buf), "%g", width / 2);
-  xmlSetProp(node, "rx", buf);
-  g_snprintf(buf, sizeof(buf), "%g", height / 2);
-  xmlSetProp(node, "ry", buf);
-  setlocale(LC_NUMERIC, old_locale);
+  dia_svg_dtostr(d_buf, center->x);
+  xmlSetProp(node, "cx", d_buf);
+  dia_svg_dtostr(d_buf, center->y);
+  xmlSetProp(node, "cy", d_buf);
+  dia_svg_dtostr(d_buf, width / 2);
+  xmlSetProp(node, "rx", d_buf);
+  dia_svg_dtostr(d_buf, height / 2);
+  xmlSetProp(node, "ry", d_buf);
 }
 
 static void
@@ -553,7 +567,12 @@
   int i;
   xmlNodePtr node;
   GString *str;
-  char *old_locale;
+  gchar p1x_buf[DTOSTR_BUF_SIZE];
+  gchar p1y_buf[DTOSTR_BUF_SIZE];
+  gchar p2x_buf[DTOSTR_BUF_SIZE];
+  gchar p2y_buf[DTOSTR_BUF_SIZE];
+  gchar p3x_buf[DTOSTR_BUF_SIZE];
+  gchar p3y_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "path", NULL);
   
@@ -561,12 +580,12 @@
 
   str = g_string_new(NULL);
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   if (points[0].type != BEZ_MOVE_TO)
     g_warning("first BezPoint must be a BEZ_MOVE_TO");
 
-  g_string_sprintf(str, "M %g %g", (double)points[0].p1.x,
-		   (double)points[0].p1.y);
+  g_string_sprintf(str, "M %s %s",
+                  dia_svg_dtostr(p1x_buf, (gdouble) points[0].p1.x),
+                  dia_svg_dtostr(p1y_buf, (gdouble) points[0].p1.y) );
 
   for (i = 1; i < numpoints; i++)
     switch (points[i].type) {
@@ -574,19 +593,22 @@
       g_warning("only first BezPoint can be a BEZ_MOVE_TO");
       break;
     case BEZ_LINE_TO:
-      g_string_sprintfa(str, " L %g,%g",
-			(double) points[i].p1.x, (double) points[i].p1.y);
+      g_string_sprintfa(str, " L %s,%s",
+                       dia_svg_dtostr(p1x_buf, (gdouble) points[i].p1.x),
+                       dia_svg_dtostr(p1y_buf, (gdouble) points[i].p1.y) );
       break;
     case BEZ_CURVE_TO:
-      g_string_sprintfa(str, " C %g,%g %g,%g %g,%g",
-			(double) points[i].p1.x, (double) points[i].p1.y,
-			(double) points[i].p2.x, (double) points[i].p2.y,
-			(double) points[i].p3.x, (double) points[i].p3.y );
+      g_string_sprintfa(str, " C %s,%s %s,%s %s,%s",
+                       dia_svg_dtostr(p1x_buf, (gdouble) points[i].p1.x),
+                       dia_svg_dtostr(p1y_buf, (gdouble) points[i].p1.y),
+                       dia_svg_dtostr(p2x_buf, (gdouble) points[i].p2.x),
+                       dia_svg_dtostr(p2y_buf, (gdouble) points[i].p2.y),
+                       dia_svg_dtostr(p3x_buf, (gdouble) points[i].p3.x),
+                       dia_svg_dtostr(p3y_buf, (gdouble) points[i].p3.y) );
       break;
     }
   xmlSetProp(node, "d", str->str);
   g_string_free(str, TRUE);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -599,7 +621,12 @@
   int i;
   xmlNodePtr node;
   GString *str;
-  char *old_locale;
+  gchar p1x_buf[DTOSTR_BUF_SIZE];
+  gchar p1y_buf[DTOSTR_BUF_SIZE];
+  gchar p2x_buf[DTOSTR_BUF_SIZE];
+  gchar p2y_buf[DTOSTR_BUF_SIZE];
+  gchar p3x_buf[DTOSTR_BUF_SIZE];
+  gchar p3y_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "path", NULL);
   
@@ -607,12 +634,12 @@
 
   str = g_string_new(NULL);
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   if (points[0].type != BEZ_MOVE_TO)
     g_warning("first BezPoint must be a BEZ_MOVE_TO");
 
-  g_string_sprintf(str, "M %g %g", (double)points[0].p1.x,
-		   (double)points[0].p1.y);
+  g_string_sprintf(str, "M %s %s",
+                  dia_svg_dtostr(p1x_buf, (gdouble) points[0].p1.x),
+                  dia_svg_dtostr(p1y_buf, (gdouble) points[0].p1.y) );
  
   for (i = 1; i < numpoints; i++)
     switch (points[i].type) {
@@ -620,20 +647,23 @@
       g_warning("only first BezPoint can be a BEZ_MOVE_TO");
       break;
     case BEZ_LINE_TO:
-      g_string_sprintfa(str, " L %g,%g",
-			(double) points[i].p1.x, (double) points[i].p1.y);
+      g_string_sprintfa(str, " L %s,%s",
+                       dia_svg_dtostr(p1x_buf, (gdouble) points[i].p1.x),
+                       dia_svg_dtostr(p1y_buf, (gdouble) points[i].p1.y) );
       break;
     case BEZ_CURVE_TO:
-      g_string_sprintfa(str, " C %g,%g %g,%g %g,%g",
-			(double) points[i].p1.x, (double) points[i].p1.y,
-			(double) points[i].p2.x, (double) points[i].p2.y,
-			(double) points[i].p3.x, (double) points[i].p3.y );
+      g_string_sprintfa(str, " C %s,%s %s,%s %s,%s",
+                       dia_svg_dtostr(p1x_buf, (gdouble) points[i].p1.x),
+                       dia_svg_dtostr(p1y_buf, (gdouble) points[i].p1.y),
+                       dia_svg_dtostr(p2x_buf, (gdouble) points[i].p2.x),
+                       dia_svg_dtostr(p2y_buf, (gdouble) points[i].p2.y),
+                       dia_svg_dtostr(p3x_buf, (gdouble) points[i].p3.x),
+                       dia_svg_dtostr(p3y_buf, (gdouble) points[i].p3.y) );
       break;
     }
   g_string_append(str, "z");
   xmlSetProp(node, "d", str->str);
   g_string_free(str, TRUE);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -644,10 +674,9 @@
 {    
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
   char *style, *tmp;
   real saved_width;
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "text", text);
  
@@ -670,9 +699,8 @@
     style = g_strconcat(style, "; text-anchor:end", NULL);
     break;
   }
-  old_locale = setlocale(LC_NUMERIC, "C");
-  tmp = g_strdup_printf("%s; font-size: %g", style, self->font_height);
-  setlocale(LC_NUMERIC, old_locale);
+  tmp = g_strdup_printf("%s; font-size: %s", style,
+                       dia_svg_dtostr(d_buf, self->font_height) );
   g_free (style);
   style = tmp;
 
@@ -691,12 +719,10 @@
   xmlSetProp(node, "style", style);
   g_free(style);
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", pos->x);
-  xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", pos->y);
-  xmlSetProp(node, "y", buf);
-  setlocale(LC_NUMERIC, old_locale);
+  dia_svg_dtostr(d_buf, pos->x);
+  xmlSetProp(node, "x", d_buf);
+  dia_svg_dtostr(d_buf, pos->y);
+  xmlSetProp(node, "y", d_buf);
 }
 
 static void
@@ -707,22 +733,19 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar d_buf[DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, NULL, "image", NULL);
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", point->x);
-  xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", point->y);
-  xmlSetProp(node, "y", buf);
-  g_snprintf(buf, sizeof(buf), "%g", width);
-  xmlSetProp(node, "width", buf);
-  g_snprintf(buf, sizeof(buf), "%g", height);
-  xmlSetProp(node, "height", buf);
+  dia_svg_dtostr(d_buf, point->x);
+  xmlSetProp(node, "x", d_buf);
+  dia_svg_dtostr(d_buf, point->y);
+  xmlSetProp(node, "y", d_buf);
+  dia_svg_dtostr(d_buf, width);
+  xmlSetProp(node, "width", d_buf);
+  dia_svg_dtostr(d_buf, height);
+  xmlSetProp(node, "height", d_buf);
   xmlSetProp(node, "xlink:href", dia_image_filename(image));
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 /* constructor */
diff -urNad dia-0.94.0/lib/dia_xml.c /tmp/dpep.5h0a8c/dia-0.94.0/lib/dia_xml.c
--- dia-0.94.0/lib/dia_xml.c	2005-04-23 22:52:34.066159696 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/lib/dia_xml.c	2005-04-23 22:52:34.938027152 +0200
@@ -21,7 +21,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <locale.h>
 #include <math.h>
 #include <fcntl.h>
 
@@ -767,33 +766,40 @@
 data_add_point(AttributeNode attr, const Point *point)
 {
   DataNode data_node;
-  char buffer[80+1]; /* Large enought? */
-  char *old_locale;
-
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buffer, 80, "%g,%g", point->x, point->y);
-  setlocale(LC_NUMERIC, old_locale);
+  gchar *buffer;
+  gchar px_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar py_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  
+  g_ascii_formatd(px_buf, sizeof(px_buf), "%g", point->x);
+  g_ascii_formatd(py_buf, sizeof(py_buf), "%g", point->y);
+  buffer = g_strconcat(px_buf, ",", py_buf, NULL);
   
   data_node = xmlNewChild(attr, NULL, "point", NULL);
   xmlSetProp(data_node, "val", buffer);
+  g_free(buffer);
 }
 
 void
 data_add_rectangle(AttributeNode attr, const Rectangle *rect)
 {
   DataNode data_node;
-  char buffer[160+1]; /* Large enough? */
-  char *old_locale;
+  gchar *buffer;
+  gchar rl_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar rr_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar rt_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar rb_buf[G_ASCII_DTOSTR_BUF_SIZE];
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buffer, 160, "%g,%g;%g,%g",
-	     rect->left, rect->top,
-	     rect->right, rect->bottom);
-  setlocale(LC_NUMERIC, old_locale);
+  g_ascii_formatd(rl_buf, sizeof(rl_buf), "%g", rect->left);
+  g_ascii_formatd(rr_buf, sizeof(rr_buf), "%g", rect->right);
+  g_ascii_formatd(rt_buf, sizeof(rt_buf), "%g", rect->top);
+  g_ascii_formatd(rb_buf, sizeof(rb_buf), "%g", rect->bottom);
+
+  buffer = g_strconcat(rl_buf, ",", rt_buf, ";", rr_buf, ",", rb_buf, NULL);
   
   data_node = xmlNewChild(attr, NULL, "rectangle", NULL);
   xmlSetProp(data_node, "val", buffer);
 
+  g_free(buffer);
 }
 
 void
diff -urNad dia-0.94.0/plug-ins/shape/shape-export.c /tmp/dpep.5h0a8c/dia-0.94.0/plug-ins/shape/shape-export.c
--- dia-0.94.0/plug-ins/shape/shape-export.c	2005-04-23 22:52:34.068159392 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/plug-ins/shape/shape-export.c	2005-04-23 22:52:34.939027000 +0200
@@ -39,7 +39,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <locale.h>
 
 /* the dots per centimetre to render this diagram at */
 /* this matches the setting `100%' setting in dia. */
@@ -271,12 +270,12 @@
                       Point *point) 
 {
   xmlNodePtr node;
-  char buf[512];
+  char buf[G_ASCII_DTOSTR_BUF_SIZE];
   
   node = xmlNewChild(renderer->connection_root, NULL, "point", NULL);
-  g_snprintf(buf, sizeof(buf), "%g", point->x);
+  g_ascii_formatd(buf, sizeof(buf), "%g", point->x);
   xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", point->y);
+  g_ascii_formatd(buf, sizeof(buf), "%g", point->y);
   xmlSetProp(node, "y", buf);
 }
 
@@ -311,6 +310,8 @@
   xmlNodePtr node;
   GString *str;
   Point center;
+  gchar px_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar py_buf[G_ASCII_DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "polyline", NULL);
   
@@ -319,7 +320,9 @@
 
   str = g_string_new(NULL);
   for (i = 0; i < num_points; i++) {
-    g_string_sprintfa(str, "%g,%g ", points[i].x, points[i].y);
+    g_string_append_printf(str, "%s,%s ",
+                          g_ascii_formatd(px_buf, sizeof(px_buf), "%g", points[i].x),
+                          g_ascii_formatd(py_buf, sizeof(py_buf), "%g", points[i].y) );
     add_connection_point(SHAPE_RENDERER(self), &points[i]);
   }
   xmlSetProp(node, "points", str->str);
@@ -343,6 +346,8 @@
   xmlNodePtr node;
   GString *str;
   Point center;
+  gchar px_buf[G_ASCII_DTOSTR_BUF_SIZE];
+  gchar py_buf[G_ASCII_DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, renderer->svg_name_space, "polygon", NULL);
   
@@ -351,7 +356,9 @@
 
   str = g_string_new(NULL);
   for (i = 0; i < num_points; i++) {
-    g_string_sprintfa(str, "%g,%g ", points[i].x, points[i].y);
+    g_string_append_printf(str, "%s,%s ",
+                          g_ascii_formatd(px_buf, sizeof(px_buf), "%g", points[i].x),
+                          g_ascii_formatd(py_buf, sizeof(py_buf), "%g", points[i].y) );
     add_connection_point(SHAPE_RENDERER(self), &points[i]);
   }
   for(i = 1; i < num_points; i++) {
@@ -453,7 +460,6 @@
     gchar *point;
     gchar *png_filename = NULL;
     DiaExportFilter *exportfilter;
-    char *old_locale;
     gfloat old_scaling;
     Rectangle *ext = &data->extents;
     gfloat scaling_x, scaling_y;
@@ -479,7 +485,6 @@
       data->paper.scaling = old_scaling;
     }
     /* create the shape */
-    old_locale = setlocale(LC_NUMERIC, "C");
     if((renderer = new_shape_renderer(data, filename))) {
       data_render(data, DIA_RENDERER(renderer), NULL, NULL, NULL);
       g_object_unref (renderer);
@@ -488,7 +493,6 @@
     /* Create a sheet entry if applicable (../../sheets exists) */
     
 
-    setlocale(LC_NUMERIC, old_locale);
     g_free(png_filename);
 }
 
diff -urNad dia-0.94.0/plug-ins/svg/render_svg.c /tmp/dpep.5h0a8c/dia-0.94.0/plug-ins/svg/render_svg.c
--- dia-0.94.0/plug-ins/svg/render_svg.c	2005-04-23 22:52:34.068159392 +0200
+++ /tmp/dpep.5h0a8c/dia-0.94.0/plug-ins/svg/render_svg.c	2005-04-23 22:52:34.939027000 +0200
@@ -29,7 +29,6 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#include <locale.h>
 
 #include <libxml/entities.h>
 #include <libxml/tree.h>
@@ -228,27 +227,24 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
  
   node = xmlNewChild(renderer->root, NULL, "rect", NULL);
 
   xmlSetProp(node, "style", 
              DIA_SVG_RENDERER_GET_CLASS(self)->get_draw_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->x);
+  g_ascii_formatd(buf, sizeof(buf), "%g", ul_corner->x);
   xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->y);
+  g_ascii_formatd(buf, sizeof(buf), "%g", ul_corner->y);
   xmlSetProp(node, "y", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->x - ul_corner->x);
+  g_ascii_formatd(buf, sizeof(buf), "%g", lr_corner->x - ul_corner->x);
   xmlSetProp(node, "width", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->y - ul_corner->y);
+  g_ascii_formatd(buf, sizeof(buf), "%g", lr_corner->y - ul_corner->y);
   xmlSetProp(node, "height", buf);
-  g_snprintf(buf, sizeof(buf),"%g", rounding);
+  g_ascii_formatd(buf, sizeof(buf),"%g", rounding);
   xmlSetProp(node, "rx", buf);
   xmlSetProp(node, "ry", buf);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -258,27 +254,24 @@
 {
   DiaSvgRenderer *renderer = DIA_SVG_RENDERER (self);
   xmlNodePtr node;
-  char buf[512];
-  char *old_locale;
+  gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
 
   node = xmlNewChild(renderer->root, NULL, "rect", NULL);
 
   xmlSetProp(node, "style", 
              DIA_SVG_RENDERER_GET_CLASS(self)->get_fill_style(renderer, colour));
 
-  old_locale = setlocale(LC_NUMERIC, "C");
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->x);
+  g_ascii_formatd(buf, sizeof(buf), "%g", ul_corner->x);
   xmlSetProp(node, "x", buf);
-  g_snprintf(buf, sizeof(buf), "%g", ul_corner->y);
+  g_ascii_formatd(buf, sizeof(buf), "%g", ul_corner->y);
   xmlSetProp(node, "y", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->x - ul_corner->x);
+  g_ascii_formatd(buf, sizeof(buf), "%g", lr_corner->x - ul_corner->x);
   xmlSetProp(node, "width", buf);
-  g_snprintf(buf, sizeof(buf), "%g", lr_corner->y - ul_corner->y);
+  g_ascii_formatd(buf, sizeof(buf), "%g", lr_corner->y - ul_corner->y);
   xmlSetProp(node, "height", buf);
-  g_snprintf(buf, sizeof(buf),"%g", rounding);
+  g_ascii_formatd(buf, sizeof(buf),"%g", rounding);
   xmlSetProp(node, "rx", buf);
   xmlSetProp(node, "ry", buf);
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static void
@@ -286,14 +279,11 @@
            const gchar *diafilename, void* user_data)
 {
   DiaSvgRenderer *renderer;
-  char *old_locale;
 
-  old_locale = setlocale(LC_NUMERIC, "C");
   if ((renderer = new_svg_renderer(data, filename))) {
     data_render(data, DIA_RENDERER(renderer), NULL, NULL, NULL);
     g_object_unref(renderer);
   }
-  setlocale(LC_NUMERIC, old_locale);
 }
 
 static const gchar *extensions[] = { "svg", NULL };

--------------030007030609000809010601--