From c9d001d550df2cbfa2b62226288040f0dcbf87e8 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 11 Jul 2019 17:31:49 -0700 Subject: [PATCH] =?UTF-8?q?Bug=20797295=20-=20problems=20with=20entering?= =?UTF-8?q?=20swedish=20=C3=A5=C3=A4=C3=B6=20in=20company=20address?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scm_c_string_length() returns the wrong answer when the C string is UTF8: It returns the number of codepoints because the SCM string is in UTF32, but we need the number of bytes for gtk_text_buffer_set_text. Fortunately scm_to_utf8_string returns a null-terminated string so we can just tell gtk_text_buffer_set_text to figure it out on its own. Guile doesn't use g_malloc so don't use g_free, and gpointer* is a void** so change the cast to void* for free. --- gnucash/gnome-utils/dialog-options.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnucash/gnome-utils/dialog-options.c b/gnucash/gnome-utils/dialog-options.c index 4b22bdefe7..e3ae2a32bf 100644 --- a/gnucash/gnome-utils/dialog-options.c +++ b/gnucash/gnome-utils/dialog-options.c @@ -3235,8 +3235,8 @@ gnc_option_set_ui_value_text (GNCOption *option, gboolean use_default, const gchar *string; string = gnc_scm_to_utf8_string (value); - gtk_text_buffer_set_text (buffer, string, scm_c_string_length(value)); - g_free ((gpointer *) string); + gtk_text_buffer_set_text (buffer, string, -1); + free ((void*) string); return FALSE; } else