Re: [gnumeric-list][PATCH to gnumeric] handle unicode and codepages for Import/Export of Excel files



On Mon, Mar 12, 2001 at 12:26:13PM +0400, gnumeric-list-admin gnome org wrote:

 It would be nice if this patch was included in Gnumeric that will be shipped
with gnome-1.4.
 
I can not include it in the next gnumeric release 0.64.  If there is
another release before 1.4 then this might go in, but it is too
significant a change to make this late.  The majority of the
utilities (modulo minor nit-picks below) look good.  However, I want
to look over the changes to the string reading routine very
carefully.  That is too central a routine to mess with lightly and
the trouble we went through getting the SST reading correct are not
things to take lightly.

Sorry.

Please supply a ChangeLog entry for your patches.

@@ -587,12 +594,23 @@
              ans->hidden = MS_BIFF_H_VISIBLE;
              break;
      }
+#if 0
      if (ver == MS_BIFF_V8) {
-             int slen = MS_OLE_GET_GUINT16 (q->data + 6);
+             int slen = MS_OLE_GET_GUINT16 (q->data + 6);            
              ans->name = biff_get_text (q->data + 8, slen, NULL);
-     } else {
+     } else 
+#endif
+     { 
+             /* 
+              * there are test files produced by non-latin1 Excel (e.g. 
+              * russian version) that prove that branch above is 
+              * incorrect. It seems test files that insured author of branch
+              * above were produced by latin1 version of Excel - 
+              * in that case q->data[7] is always 0, so it can be attributed
+              * to length of sheet name or to the string header.
+              *                      - Vlad Harchev <hvv hippo ru>
+              */
              int slen = MS_OLE_GET_GUINT8 (q->data + 6);
-
              ans->name = biff_get_text (q->data + 7, slen, NULL);
      }
Please forward copies of these workbooks to me for inclusion in the
collection of test files.
  
diff -ru -x po gnumeric-0.63~/plugins/excel/ms-excel-util.c gnumeric-0.63/plugins/excel/ms-excel-util.c
--- gnumeric-0.63~/plugins/excel/ms-excel-util.c      Tue Oct 31 20:21:05 2000
+++ gnumeric-0.63/plugins/excel/ms-excel-util.c       Mon Mar 12 10:40:20 2001

+/* comment out this if you don't have iconv available */
+#define HAVE_ICONV
+#ifdef HAVE_ICONV
+#include <iconv.h>
+#endif
 extern int ms_excel_read_debug;
This should be done via a configure.in test.
 
+static char*
+get_locale_charset_name()
This routine does not belong in the XL plugin.  We can put it in
gnumeric or even better in GAL.

+static const char* cyr_locales[] = 
+{
+     "russian", "ru", "be", "uk", NULL
+};
+
+static const s_hash_entry win_codepages[]=
+{
+     { cyr_locales , 1251 },
+     { NULL }
+};
Yukihiro could you flesh this out for some of the japanese locale's ?

+guint
+excel_iconv_win_codepage()
+     
+     if (codepage)
+             return codepage;
+     
+     /* just for flexibility */
+     if (env_lang = getenv("WINDOWS_LANGUAGE"))
+             lang = env_lang;
+     else {
+             char* locale = setlocale(LC_CTYPE,NULL);
+             char* lang_sep = strchr(locale,'_');
+             if (lang_sep)
+                     lang = g_strndup(locale,lang_sep-locale);
looks like a leak
+             else
+                     lang = locale;
+     }
+     lang = g_strdup(lang);  
looks like another leak

+     /*now search for that language in 'cyr_locales'*/
Please correct comment





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]