[tepl] File loading: FileContent: try all encodings for the fallback mode



commit d56d4c40092643993f12c792adbee59ab6edb80d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Oct 22 15:50:43 2017 +0200

    File loading: FileContent: try all encodings for the fallback mode

 tepl/tepl-file-content.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/tepl/tepl-file-content.c b/tepl/tepl-file-content.c
index d889607..6c0e4d1 100644
--- a/tepl/tepl-file-content.c
+++ b/tepl/tepl-file-content.c
@@ -20,6 +20,7 @@
 #include "tepl-file-content.h"
 #include <uchardet.h>
 #include "tepl-encoding.h"
+#include "tepl-encoding-private.h"
 
 struct _TeplFileContentPrivate
 {
@@ -204,8 +205,14 @@ _tepl_file_content_determine_encoding (TeplFileContent *content)
                GSList *candidate_encodings;
 
                candidate_encodings = tepl_encoding_get_default_candidates ();
+               candidate_encodings = g_slist_concat (candidate_encodings,
+                                                     tepl_encoding_get_all ());
+               candidate_encodings = _tepl_encoding_remove_duplicates (candidate_encodings,
+                                                                       TEPL_ENCODING_DUPLICATES_KEEP_FIRST);
+
                encoding = _tepl_file_content_determine_encoding_with_fallback_mode (content,
                                                                                     candidate_encodings);
+
                g_slist_free_full (candidate_encodings, (GDestroyNotify)tepl_encoding_free);
        }
 


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