non-latin 1 reports

zellerin at volny.cz zellerin at volny.cz
Fri Feb 13 02:10:18 CST 2004


Hello,

I was trying to make GnuCash produce reports in latin-2
characters. I was able to do so after patching gnc-html.c and
setting locales to UTF-8 (cs_CZ.UTF-8, that is), but I am not
sure this is the right way.

Questions:
- am I reinventing wheel and should I RTFM (I did try, as well as
Googled, so please point specifically) - if not, I have two
problems. Is it possible to make gnucash perform the conversion
latin-2->utf-8 when locales left to default cs_CZ? Is it possible
to specify how thousand separators should look like, other than
LC_MONETARY? It is the last thing that looks ugly on reports.

I use Gnucash 1.8.7, but nothing like this appeared in changelog
to 1.8.8.

Regards,
Tomas Z.

P.S.: Yes, I know about gnucash-devel list. I still hope it is
only question on usage :-) The patch is here only to prevent "it
is impossible" I think I saw somewhere. I do not suggest direct
including it. Should the discussion be moved to -devel, please cc
me, I am not there.

--------------------------
Patch itself (hope my web-based mailer wont botch it; if it does,
it can be found at http://www.volny.cz/zellerin/gnucash/ and is
simple enough to redo).

--- gnucash-1.8.7/src/gnome-utils/gnc-html.c	Sat Apr 12 19:03:30
2003 +++ gnucash-1.8.7/src/gnome-utils/gnc-html.c	Wed Feb 11
19:29:05 2004 @@ -57,6 +57,12 @@
 #include "gnc-ui-util.h"
 #include "messages.h"
 
+/*
+ * Larry Ewing in gtkhtml mailing list, June 2001: <q>Now this
might look like + * GtkHTML would be smart if you passed it some
other content type (...) but it + * won't right now, so don't
try</q>
+ */
+static char contenttype[]="text/html; charset=utf-8"; /* const
not allowed */  
 struct gnc_html_struct {
   GtkWidget   * container;         /* parent of the gtkhtml
widget */ @@ -458,7 +464,7 @@
   /* handles will be NULL for an HTTP POST transaction, where we
are     * displaying the reply data. */
   if(!handles) {    
-    GtkHTMLStream * handle =
gtk_html_begin(GTK_HTML(html->html)); +    GtkHTMLStream * handle
= gtk_html_begin_content(GTK_HTML(html->html), contenttype);     
if(completed_ok) {
       gtk_html_write(GTK_HTML(html->html), handle, body,
body_len);      }
@@ -974,7 +980,7 @@
   GtkHTMLStream * handle;
 
   DEBUG("datalen %d, data %20.20s", datalen, data);
-  handle = gtk_html_begin(GTK_HTML(html->html));
+  handle = gtk_html_begin_content(GTK_HTML(html->html),
contenttype);    gtk_html_write(GTK_HTML(html->html), handle,
data, datalen);
   gtk_html_end(GTK_HTML(html->html), handle,
GTK_HTML_STREAM_OK);    }
@@ -1068,7 +1074,7 @@
 	    g_strdup (extract_base_name(result.base_type,
new_location));        DEBUG("resetting base location to %s", 
html->base_location);      
-      stream = gtk_html_begin (GTK_HTML(html->html));
+      stream = gtk_html_begin_content(GTK_HTML(html->html),
contenttype);        gnc_html_load_to_stream (html, stream,
result.url_type,
                                new_location, new_label);
 
@@ -1123,7 +1129,7 @@
       /* FIXME : handle new_window = 1 */
       gnc_html_history_append(html->history,
 			      gnc_html_history_node_new(type, location, label));
-      handle = gtk_html_begin(GTK_HTML(html->html));
+      handle = gtk_html_begin_content(GTK_HTML(html->html),
contenttype);        gnc_html_load_to_stream(html, handle, type,
location, label);  
     } while (FALSE);



More information about the gnucash-user mailing list