[gnome-latex: 49/205] Conversion to UTF-8 of the command output for the compilation.
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 49/205] Conversion to UTF-8 of the command output for the compilation.
- Date: Fri, 14 Dec 2018 10:51:00 +0000 (UTC)
commit 608e7213c8ac3b2b313df466cdb82433be094f76
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Tue Sep 8 17:55:23 2009 +0200
Conversion to UTF-8 of the command output for the compilation.
The command output of latex and pdflatex is encoded in ISO-8859-1, so we
must convert it to UTF-8 to display it in a GtkTextView.
TODO | 4 ++--
src/callbacks.c | 15 ++++++++++++++-
src/symbols.c | 1 +
3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/TODO b/TODO
index e1e7eb5..d9aa4ef 100644
--- a/TODO
+++ b/TODO
@@ -27,8 +27,8 @@ Thu Sep 3, 2009 to Thu Sep 10, 2009
- position of the panes
- sceen position (center by default)
-[-] bugs correction
- - sometimes command output is not UTF-8:
+[x] bugs correction
+ x sometimes command output is not UTF-8:
Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed
x open files from the command line:
can not open relative path, only absolute
diff --git a/src/callbacks.c b/src/callbacks.c
index a5779cf..3ce27d7 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -1221,7 +1221,8 @@ run_compilation (gchar *title, gchar *command)
print_info ("execution of the command: %s", command);
GError *error = NULL;
- g_spawn_command_line_sync (command, &command_output, NULL, NULL, &error);
+ gchar *command_output_iso;
+ g_spawn_command_line_sync (command, &command_output_iso, NULL, NULL, &error);
g_chdir (dir_backup);
// an error occured
@@ -1232,6 +1233,18 @@ run_compilation (gchar *title, gchar *command)
g_error_free (error);
error = NULL;
}
+
+ // convert the command output to UTF-8
+ command_output = g_convert (command_output_iso, -1, "UTF-8",
+ "ISO-8859-1", NULL, NULL, &error);
+ if (error != NULL)
+ {
+ print_warning ("conversion of the command output failed: %s",
+ error->message);
+ command_output = g_strdup (command_output_iso);
+ g_error_free (error);
+ error = NULL;
+ }
else
is_error = FALSE;
diff --git a/src/symbols.c b/src/symbols.c
index 7570296..0e4ddcc 100644
--- a/src/symbols.c
+++ b/src/symbols.c
@@ -799,6 +799,7 @@ init_symbols (void)
{
GError *error = NULL;
+ // store the categories
GtkListStore *categories_store = gtk_list_store_new (N_COLUMNS_CAT,
GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]