diff -ur gedit-0.9.6.orig/src/print-doc.c gedit-0.9.6/src/print-doc.c --- gedit-0.9.6.orig/src/print-doc.c Sun Mar 4 04:16:11 2001 +++ gedit-0.9.6/src/print-doc.c Tue Apr 17 18:57:23 2001 @@ -274,7 +274,7 @@ return; gnome_print_moveto (pji->pc, pji->margin_left, y); - gedit_print_show_iso8859_1 (pji->pc, pji->temp); + gedit_print_show (pji->pc, pji->temp); /* Print the line number */ if (pji->print_line_numbers >0 && @@ -285,7 +285,7 @@ gnome_print_setfont (pji->pc, pji->font_numbers); gnome_print_moveto (pji->pc, pji->margin_left - pji->margin_numbers, y); - gedit_print_show_iso8859_1 (pji->pc, number_text); + gedit_print_show (pji->pc, number_text); g_free (number_text); gnome_print_setfont (pji->pc, pji->font_body); } @@ -513,14 +513,14 @@ len = gnome_font_get_width_string (pji->font_header, text1); x = pji->page_width/2 - len/2; gnome_print_moveto(pji->pc, x, y); - gedit_print_show_iso8859_1 (pji->pc, text1); + gedit_print_show (pji->pc, text1); /* Print the page/pages */ y = pji->page_height - pji->margin_top - pji->header_height/4; len = gnome_font_get_width_string (pji->font_header, text2); x = pji->page_width - len - 36; gnome_print_moveto (pji->pc, x, y); - gedit_print_show_iso8859_1 (pji->pc, text2); + gedit_print_show (pji->pc, text2); g_free (text1); g_free (text2); diff -ur gedit-0.9.6.orig/src/print-util.c gedit-0.9.6/src/print-util.c --- gedit-0.9.6.orig/src/print-util.c Sun Feb 25 23:23:56 2001 +++ gedit-0.9.6/src/print-util.c Tue Apr 17 18:56:49 2001 @@ -22,6 +22,7 @@ #include #include +#include #include @@ -31,6 +32,7 @@ #include "print.h" /* for the defined fontnames */ #include "print-util.h" +#define _PROPER_I18N /* Taken from gnumeric */ /** * g_unichar_to_utf8: @@ -93,8 +95,7 @@ return len; } - - +#ifndef _PROPER_I18N /* * print_show_iso8859_1 * @@ -137,6 +138,95 @@ return ret; } +#endif + +/* This code is taken from gnumeric. It's fully i18n-wise correct - so + feel free to copy it from here everywhere you can. + 'text' is text that is in current locale's encoding. + Code is (c) 2001 Vlad Harchev +*/ +int +gedit_print_show (GnomePrintContext *pc, char const *text) +{ +#ifdef _PROPER_I18N + wchar_t* wcs,wcbuf[4096]; + char* utf8,utf8buf[4096]; + + int conv_status; + int n = strlen(text); + int retval; + + g_return_val_if_fail (pc && text, -1); + + if ( n > (sizeof(wcbuf)/sizeof(wcbuf[0]))) + wcs = g_new(wchar_t,n); + else + wcs = wcbuf; + + conv_status = mbstowcs(wcs, text, n); + + if (conv_status == (size_t)(-1)){ + if (wcs != wcbuf) + g_free (wcs); + return 0; + }; + if (conv_status * 6 > sizeof(utf8buf)) + utf8 = g_new(gchar, conv_status * 6); + else + utf8 = utf8buf; + { + int i; + char* p = utf8; + for(i = 0; i < conv_status; ++i) + p += g_unichar_to_utf8 ( (gint) wcs[i], p); + if (wcs != wcbuf) + g_free(wcs); + retval = gnome_print_show_sized (pc, utf8, p - utf8); + } + + if (utf8 != utf8buf) + g_free(utf8); + return retval; +#else + return gedit_print_show_iso8859_1 (pc, text); +#endif +}; /** diff -ur gedit-0.9.6.orig/src/print-util.h gedit-0.9.6/src/print-util.h --- gedit-0.9.6.orig/src/print-util.h Sun Feb 25 07:35:37 2001 +++ gedit-0.9.6/src/print-util.h Tue Apr 17 18:57:35 2001 @@ -1,8 +1,9 @@ #ifndef __GEDIT_PRINT_UTIL_H__ #define __GEDIT_PRINT_UTIL_H__ -int gedit_print_show_iso8859_1 (GnomePrintContext *pc, char const *text); +int gedit_print_show (GnomePrintContext *pc, char const *text); gboolean gedit_print_verify_fonts (void);