Fix clipboard export of non-ascii strings.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 28 Jul 2009 04:46:24 +0000 (06:46 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 28 Jul 2009 04:46:24 +0000 (06:46 +0200)
Fixed problem pasting sheet data from psppire to
openoffice.org and gnumeric which contained non-ascii
characters.  Tested with openoffice.org 2.4 and
gnumeric 1.8.3

src/ui/gui/psppire-data-editor.c

index aa511e937b69de617bcb4151a827dc971a53ce1e..ec7263af76698a457e6bf15e9379e2c205891baa 100644 (file)
@@ -1620,6 +1620,7 @@ data_sheet_set_clip (PsppireSheet *sheet)
 
   /* Construct clip dictionary. */
   clip_dict = dict_create ();
 
   /* Construct clip dictionary. */
   clip_dict = dict_create ();
+  dict_set_encoding (clip_dict, dict_get_encoding (ds->dict->dict));
   for (i = range.col0; i <= range.coli; i++)
     {
       const struct variable *old = dict_get_var (ds->dict->dict, i);
   for (i = range.col0; i <= range.coli; i++)
     {
       const struct variable *old = dict_get_var (ds->dict->dict, i);
@@ -1719,9 +1720,11 @@ clip_to_html (void)
   const casenumber case_cnt = casereader_get_case_cnt (clip_datasheet);
   const size_t var_cnt = dict_get_var_cnt (clip_dict);
 
   const casenumber case_cnt = casereader_get_case_cnt (clip_datasheet);
   const size_t var_cnt = dict_get_var_cnt (clip_dict);
 
-
   /* Guestimate the size needed */
   /* Guestimate the size needed */
-  string = g_string_sized_new (20 * val_cnt * case_cnt);
+  string = g_string_sized_new (80 + 20 * val_cnt * case_cnt);
+
+  g_string_append (string,
+                  "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
 
   g_string_append (string, "<table>\n");
   for (r = 0 ; r < case_cnt ; ++r )
 
   g_string_append (string, "<table>\n");
   for (r = 0 ; r < case_cnt ; ++r )