[gtksourceview/wip/uchardet] BufferOutputStream: fix gtk_source_buffer_output_stream_get_guessed()...
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/uchardet] BufferOutputStream: fix gtk_source_buffer_output_stream_get_guessed()...
- Date: Sat, 28 Nov 2015 18:40:59 +0000 (UTC)
commit a2ae71d75fc679be71e6a2adeb2a70e3cae23615
Author: Jehan <jehan girinstud io>
Date: Sat Nov 28 19:22:15 2015 +0100
BufferOutputStream: fix gtk_source_buffer_output_stream_get_guessed()...
... when uchardet is used.
gtksourceview/gtksourcebufferoutputstream.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcebufferoutputstream.c b/gtksourceview/gtksourcebufferoutputstream.c
index 156e02e..01cb01b 100644
--- a/gtksourceview/gtksourcebufferoutputstream.c
+++ b/gtksourceview/gtksourcebufferoutputstream.c
@@ -572,6 +572,23 @@ gtk_source_buffer_output_stream_get_guessed (GtkSourceBufferOutputStream *stream
*/
return gtk_source_encoding_get_utf8 ();
}
+ else if (stream->priv->charset_conv)
+ {
+ /* When detecting with uchardet, current_encoding is NULL,
+ * but there is a GCharsetConverter. */
+ const GtkSourceEncoding *enc = NULL;
+ gchar *charset_name = NULL;
+
+ g_object_get (stream->priv->charset_conv,
+ "from-charset", &charset_name,
+ NULL);
+ if (charset_name != NULL)
+ {
+ enc = gtk_source_encoding_get_from_charset (charset_name);
+ g_free (charset_name);
+ return enc;
+ }
+ }
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]