[gtksourceview/wip/uchardet-2: 5/5] BufferOutputStream: fix get_guessed() when uchardet is used
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/uchardet-2: 5/5] BufferOutputStream: fix get_guessed() when uchardet is used
- Date: Fri, 4 Dec 2015 16:19:42 +0000 (UTC)
commit 8d3d43f7afd780ea0ea9b75072929aa5642ed2a7
Author: Jehan <jehan girinstud io>
Date: Sat Nov 28 19:22:15 2015 +0100
BufferOutputStream: fix get_guessed() when uchardet is used
gtksourceview/gtksourcebufferoutputstream.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcebufferoutputstream.c b/gtksourceview/gtksourcebufferoutputstream.c
index 060f5e8..d670eb8 100644
--- a/gtksourceview/gtksourcebufferoutputstream.c
+++ b/gtksourceview/gtksourcebufferoutputstream.c
@@ -573,6 +573,26 @@ gtk_source_buffer_output_stream_get_guessed (GtkSourceBufferOutputStream *stream
*/
return gtk_source_encoding_get_utf8 ();
}
+ else if (stream->priv->charset_conv != NULL)
+ {
+ /* When detecting with uchardet, current_encoding is NULL, but
+ * there is a GCharsetConverter.
+ */
+ gchar *charset_name = NULL;
+
+ g_object_get (stream->priv->charset_conv,
+ "from-charset", &charset_name,
+ NULL);
+
+ if (charset_name != NULL)
+ {
+ const GtkSourceEncoding *enc;
+
+ 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]