[dates] Unset the file encoding when importing



commit 55152e4360b4d12b1157d63e31f24f1aa9882524
Author: Long Bu <long bu intel com>
Date:   Wed Jul 29 16:28:31 2009 +0100

    Unset the file encoding when importing
    
    Signed-off-by: Ross Burton <ross linux intel com>

 src/dates_callbacks.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/dates_callbacks.c b/src/dates_callbacks.c
index 4979371..23213ed 100644
--- a/src/dates_callbacks.c
+++ b/src/dates_callbacks.c
@@ -1814,6 +1814,17 @@ dates_import_calendar_data_from_file (ECal *cal, gchar *filename, GError **error
     GIOStatus status;
     icalparser *parser = icalparser_new ();
 
+    /* set the channel as binary mode and let icalparser_add_line
+     * handle encoding */
+    g_io_channel_set_encoding (channel, NULL, &tmp_error);
+    if (tmp_error != NULL)
+    {
+      g_warning ("Error when set encoding: %s", tmp_error->message);
+      g_propagate_error (error, tmp_error);
+      g_io_channel_unref (channel);
+      return FALSE;
+    }
+
     /* Read the from the file line by line and until EOF */
     while ((status = g_io_channel_read_line (channel, &line, &length, NULL, &tmp_error))
         == G_IO_STATUS_NORMAL)



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