r23556 - gnucash/trunk/src - Use scm_[to/from]_utf8_string instead of scm_[to/from]_locale_string as per guile recommendation
Geert Janssens
gjanssens at code.gnucash.org
Fri Dec 13 15:21:42 EST 2013
Author: gjanssens
Date: 2013-12-13 15:21:41 -0500 (Fri, 13 Dec 2013)
New Revision: 23556
Trac: http://svn.gnucash.org/trac/changeset/23556
Modified:
gnucash/trunk/src/app-utils/gfec.c
gnucash/trunk/src/app-utils/gnc-exp-parser.c
gnucash/trunk/src/app-utils/gnc-helpers.c
gnucash/trunk/src/app-utils/gnc-ui-util.c
gnucash/trunk/src/app-utils/guile-util.c
gnucash/trunk/src/app-utils/option-util.c
gnucash/trunk/src/app-utils/test/test-print-queries.c
gnucash/trunk/src/app-utils/test/test-scm-query-string.c
gnucash/trunk/src/base-typemaps.i
gnucash/trunk/src/business/business-gnome/dialog-invoice.c
gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c
gnucash/trunk/src/core-utils/gnc-guile-utils.c
gnucash/trunk/src/core-utils/gnc-guile-utils.h
gnucash/trunk/src/engine/engine-helpers.c
gnucash/trunk/src/engine/glib-helpers.c
gnucash/trunk/src/engine/kvp-scm.c
gnucash/trunk/src/gnome-utils/dialog-options.c
gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
gnucash/trunk/src/gnome/dialog-tax-info.c
gnucash/trunk/src/gnome/gnc-plugin-page-register.c
gnucash/trunk/src/gnome/gnc-plugin-page-register2.c
gnucash/trunk/src/guile-mappings.h
gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c
gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
gnucash/trunk/src/register/ledger-core/split-register-control.c
gnucash/trunk/src/register/ledger-core/split-register.c
gnucash/trunk/src/report/report-gnome/dialog-custom-report.c
gnucash/trunk/src/report/report-gnome/dialog-report-column-view.c
gnucash/trunk/src/report/report-gnome/dialog-report-style-sheet.c
gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
gnucash/trunk/src/report/report-gnome/window-report.c
gnucash/trunk/src/report/report-system/gnc-report.c
Log:
Use scm_[to/from]_utf8_string instead of scm_[to/from]_locale_string as per guile recommendation
Notes:
- in some situations the original *locale_string variant is retained. This
is when locale encoded strings are processed (mostly file names).
- the utf8 variants don't exist for guile 1.8. For that version these
functions will be rededefined to call the locale variants.
Modified: gnucash/trunk/src/app-utils/gfec.c
===================================================================
--- gnucash/trunk/src/app-utils/gfec.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/gfec.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -27,7 +27,7 @@
{
helper_data_t* ptr = ptr_void;
g_assert(ptr);
- *(ptr->msg) = gnc_scm_to_locale_string(*ptr->scm_string);
+ *(ptr->msg) = gnc_scm_to_utf8_string(*ptr->scm_string);
return SCM_UNDEFINED;
}
@@ -81,7 +81,7 @@
(void *) &helper_data,
gfec_catcher,
&internal_err_msg);
- // Previously: msg = gnc_scm_to_locale_string (result);
+ // Previously: msg = gnc_scm_to_utf8_string (result);
// Did we run into an exception? Then the output argument msg is
// not set (due to the exception), but err_msg is set and contains
Modified: gnucash/trunk/src/app-utils/gnc-exp-parser.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-exp-parser.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/gnc-exp-parser.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -315,7 +315,7 @@
break;
case VST_STRING:
str = (char*)(vs->value);
- scmTmp = scm_from_locale_string( str );
+ scmTmp = scm_from_utf8_string( str );
break;
default:
/* FIXME: error */
Modified: gnucash/trunk/src/app-utils/gnc-helpers.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-helpers.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/gnc-helpers.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -125,11 +125,11 @@
SWIG_TypeQuery("_p_gnc_commodity"), 0);
if (tz)
- info_scm = scm_cons (scm_from_locale_string (tz), info_scm);
+ info_scm = scm_cons (scm_from_utf8_string (tz), info_scm);
else
info_scm = scm_cons (SCM_BOOL_F, info_scm);
info_scm = scm_cons (def_comm_scm, info_scm);
info_scm = scm_cons (comm_scm, info_scm);
- info_scm = scm_cons (name ? scm_from_locale_string (name) : SCM_BOOL_F, info_scm);
+ info_scm = scm_cons (name ? scm_from_utf8_string (name) : SCM_BOOL_F, info_scm);
return info_scm;
}
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -353,7 +353,7 @@
return g_strdup (_("Tax entity type not specified"));
atype = xaccAccountGetType (account);
- tax_entity_type = scm_from_locale_string (tax_type);
+ tax_entity_type = scm_from_utf8_string (tax_type);
if (get_form == SCM_UNDEFINED)
{
@@ -455,13 +455,13 @@
{
gchar *form = NULL;
- /* Note: using scm_to_locale_string directly here instead
- of our wrapper gnc_scm_to_locale_string. 'form' should
+ /* Note: using scm_to_utf8_string directly here instead
+ of our wrapper gnc_scm_to_utf8_string. 'form' should
be freed with 'free' instead of 'g_free'. This will
be taken care of automatically during scm_dynwind_end,
because we inform guile of this memory allocation via
scm_dynwind_free a little further. */
- form = scm_to_locale_string (form_scm);
+ form = scm_to_utf8_string (form_scm);
if (!form)
{
if (tax_related)
@@ -497,7 +497,7 @@
else
{
gchar *desc = NULL;
- desc = gnc_scm_to_locale_string (desc_scm);
+ desc = gnc_scm_to_utf8_string (desc_scm);
if (!desc)
{
if (tax_related)
Modified: gnucash/trunk/src/app-utils/guile-util.c
===================================================================
--- gnucash/trunk/src/app-utils/guile-util.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/guile-util.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -311,7 +311,7 @@
if (guid_string == NULL)
return;
- arg = scm_from_locale_string(guid_string);
+ arg = scm_from_utf8_string(guid_string);
scm_call_2(setters.split_scm_account_guid, split_scm, arg);
}
@@ -337,7 +337,7 @@
if (memo == NULL)
return;
- arg = scm_from_locale_string(memo);
+ arg = scm_from_utf8_string(memo);
scm_call_2(setters.split_scm_memo, split_scm, arg);
}
@@ -363,7 +363,7 @@
if (action == NULL)
return;
- arg = scm_from_locale_string(action);
+ arg = scm_from_utf8_string(action);
scm_call_2(setters.split_scm_action, split_scm, arg);
}
@@ -460,7 +460,7 @@
if (!scm_is_string(result))
return NULL;
- return gnc_scm_to_locale_string(result);
+ return gnc_scm_to_utf8_string(result);
}
@@ -485,7 +485,7 @@
if (!scm_is_string(result))
return NULL;
- return gnc_scm_to_locale_string(result);
+ return gnc_scm_to_utf8_string(result);
}
@@ -668,8 +668,8 @@
args = scm_cons(commit, args);
- from = scm_from_locale_string(guid_to_string(guid_1));
- to = scm_from_locale_string(guid_to_string(guid_2));
+ from = scm_from_utf8_string(guid_to_string(guid_1));
+ to = scm_from_utf8_string(guid_to_string(guid_2));
map = scm_cons(scm_cons(from, to), map);
map = scm_cons(scm_cons(to, from), map);
@@ -728,7 +728,7 @@
if (num == NULL)
return;
- arg = scm_from_locale_string(num);
+ arg = scm_from_utf8_string(num);
scm_call_2(setters.trans_scm_num, trans_scm, arg);
}
@@ -754,7 +754,7 @@
if (description == NULL)
return;
- arg = scm_from_locale_string(description);
+ arg = scm_from_utf8_string(description);
scm_call_2(setters.trans_scm_description, trans_scm, arg);
}
@@ -780,7 +780,7 @@
if (notes == NULL)
return;
- arg = scm_from_locale_string(notes);
+ arg = scm_from_utf8_string(notes);
scm_call_2(setters.trans_scm_notes, trans_scm, arg);
}
@@ -914,7 +914,7 @@
if (!scm_is_string(result))
return NULL;
- return scm_to_locale_string(result);
+ return scm_to_utf8_string(result);
}
@@ -945,7 +945,7 @@
if (!scm_is_string(result))
return NULL;
- return gnc_scm_to_locale_string(result);
+ return gnc_scm_to_utf8_string(result);
}
Modified: gnucash/trunk/src/app-utils/option-util.c
===================================================================
--- gnucash/trunk/src/app-utils/option-util.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/option-util.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -473,7 +473,7 @@
}
else
{
- arg = scm_from_locale_string(name);
+ arg = scm_from_utf8_string(name);
}
args = scm_cons(arg, args);
@@ -484,7 +484,7 @@
}
else
{
- arg = scm_from_locale_string(section);
+ arg = scm_from_utf8_string(section);
}
args = scm_cons(arg, args);
@@ -914,7 +914,7 @@
if (!scm_is_string(name))
return NULL;
- return gnc_scm_to_locale_string (name);
+ return gnc_scm_to_utf8_string (name);
}
@@ -945,7 +945,7 @@
if (!scm_is_string(help))
return NULL;
- return gnc_scm_to_locale_string (help);
+ return gnc_scm_to_utf8_string (help);
}
@@ -1693,7 +1693,7 @@
return;
}
- message = gnc_scm_to_locale_string (oops);
+ message = gnc_scm_to_utf8_string (oops);
name = gnc_option_name(option);
section = gnc_option_section(option);
@@ -1896,7 +1896,7 @@
if (!scm_is_string(value))
return NULL;
- return gnc_scm_to_locale_string (value);
+ return gnc_scm_to_utf8_string (value);
}
@@ -2002,7 +2002,7 @@
{
value = scm_call_0(getter);
if (scm_is_string(value))
- return gnc_scm_to_locale_string (value);
+ return gnc_scm_to_utf8_string (value);
}
}
@@ -2549,7 +2549,7 @@
return FALSE;
if (value)
- scm_value = scm_from_locale_string(value);
+ scm_value = scm_from_utf8_string(value);
else
scm_value = SCM_BOOL_F;
@@ -2737,7 +2737,7 @@
break;
if (custom)
- *custom = gnc_scm_to_locale_string (val);
+ *custom = gnc_scm_to_utf8_string (val);
return FALSE;
@@ -2756,7 +2756,7 @@
/* build the list in reverse order */
if (custom)
- val = scm_from_locale_string(custom);
+ val = scm_from_utf8_string(custom);
else
val = SCM_BOOL_F;
value = scm_cons(val, value);
Modified: gnucash/trunk/src/app-utils/test/test-print-queries.c
===================================================================
--- gnucash/trunk/src/app-utils/test/test-print-queries.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/test/test-print-queries.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -23,7 +23,7 @@
args = scm_cons (scm_q, SCM_EOL);
str_q = scm_apply (val2str, args, SCM_EOL);
- args = scm_cons (scm_from_locale_string ("'"), scm_cons (str_q, SCM_EOL));
+ args = scm_cons (scm_from_utf8_string ("'"), scm_cons (str_q, SCM_EOL));
str_q = scm_string_append (args);
scm_display (str_q, SCM_UNDEFINED);
Modified: gnucash/trunk/src/app-utils/test/test-scm-query-string.c
===================================================================
--- gnucash/trunk/src/app-utils/test/test-scm-query-string.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/app-utils/test/test-scm-query-string.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -27,10 +27,10 @@
args = scm_cons (scm_q, SCM_EOL);
str_q = scm_apply (val2str, args, SCM_EOL);
- args = scm_cons (scm_from_locale_string ("'"), scm_cons (str_q, SCM_EOL));
+ args = scm_cons (scm_from_utf8_string ("'"), scm_cons (str_q, SCM_EOL));
str_q = scm_string_append (args);
- str2 = gnc_scm_to_locale_string (str_q);
+ str2 = gnc_scm_to_utf8_string (str_q);
if (str2)
{
res_q = scm_c_eval_string (str2);
Modified: gnucash/trunk/src/base-typemaps.i
===================================================================
--- gnucash/trunk/src/base-typemaps.i 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/base-typemaps.i 2013-12-13 20:21:41 UTC (rev 23556)
@@ -19,7 +19,7 @@
%typemap (out) char * {
$result = SCM_UNSPECIFIED;
if ($1) {
- $result = scm_from_locale_string((const char *)$1);
+ $result = scm_from_utf8_string((const char *)$1);
}
if (!$1 || !scm_is_true($result)) {
$result = scm_c_make_string(0, SCM_UNDEFINED);
Modified: gnucash/trunk/src/business/business-gnome/dialog-invoice.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-invoice.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/business/business-gnome/dialog-invoice.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -651,7 +651,7 @@
g_return_if_fail (scm_is_procedure (func));
arg = SWIG_NewPointerObj(invoice, SWIG_TypeQuery("_p__gncInvoice"), 0);
- arg2 = scm_from_locale_string(reportname);
+ arg2 = scm_from_utf8_string(reportname);
args = scm_cons2 (arg, arg2, args);
/* scm_gc_protect_object(func); */
Modified: gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/business/business-gnome/gnc-plugin-page-owner-tree.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -915,7 +915,7 @@
g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
/* Option Report title */
- arg = scm_from_locale_string (report_title);
+ arg = scm_from_utf8_string (report_title);
args = scm_cons (arg, args);
/* Option Account - Using False to select default account
Modified: gnucash/trunk/src/core-utils/gnc-guile-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-guile-utils.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/core-utils/gnc-guile-utils.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -32,9 +32,41 @@
/********************************************************************\
+ * gnc_scm_to_utf8_string *
+ * returns the string representation of the scm string in *
+ * a newly allocated gchar * or NULL if it can't be retrieved. *
+ * *
+ * Args: symbol_value - the scm symbol *
+ * Returns: newly allocated gchar * or NULL, should be freed with *
+ * g_free by the caller *
+\********************************************************************/
+gchar *gnc_scm_to_utf8_string(SCM scm_string)
+{
+ if (scm_is_string (scm_string))
+ {
+ gchar* s;
+ char * str;
+
+ str = scm_to_utf8_string(scm_string);
+ s = g_strdup(str);
+ free (str);
+ return s;
+ }
+
+ /* Unable to extract string from the symbol...*/
+ PERR("bad value\n");
+ return NULL;
+}
+
+
+/********************************************************************\
* gnc_scm_to_locale_string *
* returns the string representation of the scm string in *
* a newly allocated gchar * or NULL if it can't be retrieved. *
+ * The string will be encoded in the current locale's encoding. *
+ * Note: this function should only be use to convert filenames or *
+ * strings from the environment. Or other strings that are in the *
+ * system locale. *
* *
* Args: symbol_value - the scm symbol *
* Returns: newly allocated gchar * or NULL, should be freed with *
@@ -77,7 +109,7 @@
SCM string_value = scm_symbol_to_string (symbol_value);
if (scm_is_string (string_value))
{
- char *tmp = scm_to_locale_string (string_value);
+ char *tmp = scm_to_utf8_string (string_value);
gchar *str = g_strdup (tmp);
free (tmp);
return str;
@@ -110,7 +142,7 @@
if (scm_is_string(value))
{
- return gnc_scm_to_locale_string(value);
+ return gnc_scm_to_utf8_string(value);
}
else
{
@@ -265,7 +297,7 @@
gchar *raw_text, *text, **splits;
gint i, j;
- raw_text = gnc_scm_to_locale_string (scm_text);
+ raw_text = gnc_scm_to_utf8_string (scm_text);
splits = g_strsplit(raw_text, "\n", -1);
for (i = j = 0; splits[i]; i++)
{
Modified: gnucash/trunk/src/core-utils/gnc-guile-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-guile-utils.h 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/core-utils/gnc-guile-utils.h 2013-12-13 20:21:41 UTC (rev 23556)
@@ -31,6 +31,16 @@
* a guile string.
*
* Returns a newly allocated string that must be freed with g_free*/
+gchar * gnc_scm_to_utf8_string(SCM scm_string);
+
+/** Helper function to get the string representation of
+ * a guile string.
+ * The string will be encoded in the current locale's encoding.
+ * Note: this function should only be use to convert filenames or
+ * strings from the environment. Or other strings that are in the
+ * system locale.
+ *
+ * Returns a newly allocated string that must be freed with g_free*/
gchar * gnc_scm_to_locale_string(SCM scm_string);
/** Helper function to get the string representation of
Modified: gnucash/trunk/src/engine/engine-helpers.c
===================================================================
--- gnucash/trunk/src/engine/engine-helpers.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/engine/engine-helpers.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -314,7 +314,7 @@
if (!guid_to_string_buff(&guid, string))
return SCM_BOOL_F;
- return scm_from_locale_string(string);
+ return scm_from_utf8_string(string);
}
GncGUID
@@ -328,7 +328,7 @@
{
return *guid_null();
}
- str = gnc_scm_to_locale_string (guid_scm);
+ str = gnc_scm_to_utf8_string (guid_scm);
string_to_guid(str, &guid);
g_free (str);
return guid;
@@ -348,7 +348,7 @@
{
return FALSE;
}
- str = gnc_scm_to_locale_string (guid_scm);
+ str = gnc_scm_to_utf8_string (guid_scm);
return_int = string_to_guid(str, &guid);
g_free (str);
return return_int;
@@ -677,7 +677,7 @@
const char *key = node->data;
if (key)
- path_scm = scm_cons (scm_from_locale_string (key), path_scm);
+ path_scm = scm_cons (scm_from_utf8_string (key), path_scm);
}
return scm_reverse (path_scm);
@@ -700,7 +700,7 @@
if (!scm_is_string (key_scm))
break;
- key = gnc_scm_to_locale_string(key_scm);
+ key = gnc_scm_to_utf8_string(key_scm);
path = g_slist_prepend (path, key);
path_scm = SCM_CDR (path_scm);
}
@@ -753,7 +753,7 @@
case KVP_TYPE_STRING:
string = kvp_value_get_string (value);
- scm = string ? scm_from_locale_string (string) : SCM_BOOL_F;
+ scm = string ? scm_from_utf8_string (string) : SCM_BOOL_F;
break;
case KVP_TYPE_GUID:
@@ -813,7 +813,7 @@
SCM key_scm;
SCM pair;
- key_scm = key ? scm_from_locale_string (key) : SCM_BOOL_F;
+ key_scm = key ? scm_from_utf8_string (key) : SCM_BOOL_F;
value_scm = gnc_kvp_value2scm (value);
pair = scm_cons (key_scm, value_scm);
@@ -869,7 +869,7 @@
case KVP_TYPE_STRING:
{
gchar * str;
- str = gnc_scm_to_locale_string (val_scm);
+ str = gnc_scm_to_utf8_string (val_scm);
value = kvp_value_new_string (str);
g_free (str);
break;
@@ -983,7 +983,7 @@
if (!scm_is_string (key_scm))
continue;
- key = scm_to_locale_string (key_scm); /* key should be freed with free !
+ key = scm_to_utf8_string (key_scm); /* key should be freed with free !
This is automatically taken care
of by scm_dynwind_free below. */
scm_dynwind_begin (0);
@@ -1028,7 +1028,7 @@
qt_scm = scm_cons (scm_from_long (pdata->options), qt_scm);
qt_scm = scm_cons (SCM_BOOL (pdata->is_regex), qt_scm);
- qt_scm = scm_cons (pdata->matchstring ? scm_from_locale_string (pdata->matchstring) : SCM_BOOL_F, qt_scm);
+ qt_scm = scm_cons (pdata->matchstring ? scm_from_utf8_string (pdata->matchstring) : SCM_BOOL_F, qt_scm);
}
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_DATE))
@@ -1081,7 +1081,7 @@
query_char_t pdata = (query_char_t) pd;
qt_scm = scm_cons (scm_from_long (pdata->options), qt_scm);
- qt_scm = scm_cons (pdata->char_list ? scm_from_locale_string (pdata->char_list) : SCM_BOOL_F, qt_scm);
+ qt_scm = scm_cons (pdata->char_list ? scm_from_utf8_string (pdata->char_list) : SCM_BOOL_F, qt_scm);
}
else if (!g_strcmp0 (pd->type_name, QOF_TYPE_KVP))
@@ -1167,7 +1167,7 @@
qt_scm = SCM_CDR (qt_scm);
if (!scm_is_string (scm)) break;
- matchstring = gnc_scm_to_locale_string (scm);
+ matchstring = gnc_scm_to_utf8_string (scm);
pd = qof_query_string_predicate (compare_how, matchstring,
options, is_regex);
@@ -1289,7 +1289,7 @@
qt_scm = SCM_CDR (qt_scm);
if (!scm_is_string (scm))
break;
- char_list = gnc_scm_to_locale_string (scm);
+ char_list = gnc_scm_to_utf8_string (scm);
pd = qof_query_char_predicate (options, char_list);
g_free (char_list);
@@ -1560,7 +1560,7 @@
scm = SCM_CAR (query_term_scm);
query_term_scm = SCM_CDR (query_term_scm);
- matchstring = gnc_scm_to_locale_string (scm);
+ matchstring = gnc_scm_to_utf8_string (scm);
if (!g_strcmp0 (pr_type, "pr-action"))
{
@@ -1646,7 +1646,7 @@
/* id type */
scm = SCM_CAR (query_term_scm);
query_term_scm = SCM_CDR (query_term_scm);
- id_type = (QofIdType) gnc_scm_to_locale_string (scm);
+ id_type = (QofIdType) gnc_scm_to_utf8_string (scm);
xaccQueryAddGUIDMatch (q, &guid, id_type, QOF_QUERY_OR);
g_free ((void *) id_type);
Modified: gnucash/trunk/src/engine/glib-helpers.c
===================================================================
--- gnucash/trunk/src/engine/glib-helpers.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/engine/glib-helpers.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -102,7 +102,7 @@
for (node = glist; node; node = node->next)
{
if (node->data)
- list = scm_cons (scm_from_locale_string(node->data), list);
+ list = scm_cons (scm_from_utf8_string(node->data), list);
else
list = scm_cons (SCM_BOOL_F, list);
}
@@ -131,7 +131,7 @@
{
gchar * str;
- str = gnc_scm_to_locale_string (SCM_CAR(list));
+ str = gnc_scm_to_utf8_string (SCM_CAR(list));
if (str)
glist = g_list_prepend (glist, g_strdup (str));
g_free (str);
@@ -153,7 +153,7 @@
{
gchar * str;
- str = gnc_scm_to_locale_string (SCM_CAR(list));
+ str = gnc_scm_to_utf8_string (SCM_CAR(list));
if (str)
gslist = g_slist_prepend (gslist, g_strdup (str));
g_free (str);
Modified: gnucash/trunk/src/engine/kvp-scm.c
===================================================================
--- gnucash/trunk/src/engine/kvp-scm.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/engine/kvp-scm.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -49,7 +49,7 @@
{
gchar *newstr;
KvpValue *ret;
- newstr = gnc_scm_to_locale_string (val);
+ newstr = gnc_scm_to_utf8_string (val);
ret = kvp_value_new_string(newstr);
g_free (newstr);
return ret;
@@ -84,7 +84,7 @@
break;
case KVP_TYPE_STRING:
string = kvp_value_get_string(val);
- return string ? scm_from_locale_string(string) : SCM_BOOL_F;
+ return string ? scm_from_utf8_string(string) : SCM_BOOL_F;
break;
case KVP_TYPE_GUID:
{
Modified: gnucash/trunk/src/gnome/dialog-tax-info.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-tax-info.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/gnome/dialog-tax-info.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -242,7 +242,7 @@
}
else
{
- tax_entity_type = scm_from_locale_string (ti_dialog->tax_type);
+ tax_entity_type = scm_from_utf8_string (ti_dialog->tax_type);
}
switch (acct_category)
@@ -337,19 +337,19 @@
scm = scm_call_3 (getters.form, category, code_scm, tax_entity_type);
if (scm_is_string(scm))
- txf_info->form = gnc_scm_to_locale_string(scm);
+ txf_info->form = gnc_scm_to_utf8_string(scm);
else
txf_info->form = g_strdup ("");
scm = scm_call_3 (getters.description, category, code_scm, tax_entity_type);
if (scm_is_string(scm))
- txf_info->description = gnc_scm_to_locale_string(scm);
+ txf_info->description = gnc_scm_to_utf8_string(scm);
else
txf_info->description = g_strdup ("");
scm = scm_call_2 (getters.help, category, code_scm);
if (scm_is_string(scm))
- help_text = gnc_scm_to_locale_string(scm);
+ help_text = gnc_scm_to_utf8_string(scm);
else
help_text = g_strdup ("");
@@ -377,7 +377,7 @@
line_year = scm_is_bool (SCM_CAR (year_scm)) ? 0 :
scm_to_int (SCM_CAR (year_scm));
if (scm_is_string((SCM_CAR (SCM_CDR (year_scm)))))
- line = gnc_scm_to_locale_string((SCM_CAR (SCM_CDR
+ line = gnc_scm_to_utf8_string((SCM_CAR (SCM_CDR
(year_scm))));
else
line = g_strdup ("");
@@ -486,13 +486,13 @@
scm = scm_call_1 (getters.tax_entity_type, type_scm);
if (scm_is_string(scm))
- tax_type_info->type = gnc_scm_to_locale_string(scm);
+ tax_type_info->type = gnc_scm_to_utf8_string(scm);
else
tax_type_info->type = g_strdup ("");
scm = scm_call_1 (getters.tax_entity_desc, type_scm);
if (scm_is_string(scm))
- tax_type_info->description = gnc_scm_to_locale_string(scm);
+ tax_type_info->description = gnc_scm_to_utf8_string(scm);
else
tax_type_info->description = g_strdup ("");
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -2616,15 +2616,15 @@
g_return_val_if_fail (scm_is_procedure (func), -1);
tmp = gnc_split_register_get_credit_string (reg);
- arg = scm_from_locale_string (tmp ? tmp : _("Credit"));
+ arg = scm_from_utf8_string (tmp ? tmp : _("Credit"));
args = scm_cons (arg, args);
tmp = gnc_split_register_get_debit_string (reg);
- arg = scm_from_locale_string (tmp ? tmp : _("Debit"));
+ arg = scm_from_utf8_string (tmp ? tmp : _("Debit"));
args = scm_cons (arg, args);
str = gnc_reg_get_name (ledger, FALSE);
- arg = scm_from_locale_string (str ? str : "");
+ arg = scm_from_utf8_string (str ? str : "");
args = scm_cons (arg, args);
g_free (str);
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register2.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register2.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -2460,14 +2460,14 @@
g_return_val_if_fail (scm_is_procedure (func), -1);
tmp = gnc_tree_view_split_reg_get_credit_debit_string (view, TRUE);
- arg = scm_from_locale_string (tmp ? tmp : _("Credit"));
+ arg = scm_from_utf8_string (tmp ? tmp : _("Credit"));
args = scm_cons (arg, args);
tmp = gnc_tree_view_split_reg_get_credit_debit_string (view, FALSE);
- arg = scm_from_locale_string (tmp ? tmp : _("Debit"));
+ arg = scm_from_utf8_string (tmp ? tmp : _("Debit"));
args = scm_cons (arg, args);
str = gnc_reg_get_name (ledger, FALSE);
- arg = scm_from_locale_string (str ? str : "");
+ arg = scm_from_utf8_string (str ? str : "");
args = scm_cons (arg, args);
g_free (str);
Modified: gnucash/trunk/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-options.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/gnome-utils/dialog-options.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -2177,7 +2177,7 @@
{
const gchar *string;
- string = gnc_scm_to_locale_string (value);
+ string = gnc_scm_to_utf8_string (value);
gtk_entry_set_text(GTK_ENTRY(widget), string);
g_free ((gpointer *) string);
return FALSE;
@@ -2201,7 +2201,7 @@
{
const gchar *string;
- string = gnc_scm_to_locale_string (value);
+ string = gnc_scm_to_utf8_string (value);
gtk_text_buffer_set_text (buffer, string, scm_c_string_length(value));
g_free ((gpointer *) string);
return FALSE;
@@ -2475,7 +2475,7 @@
{
const gchar *string;
- string = gnc_scm_to_locale_string (value);
+ string = gnc_scm_to_utf8_string (value);
if ((string != NULL) && (*string != '\0'))
{
GtkFontButton *font_button = GTK_FONT_BUTTON(widget);
@@ -2636,7 +2636,7 @@
SCM result;
string = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
- result = scm_from_locale_string(string ? string : "");
+ result = scm_from_utf8_string(string ? string : "");
g_free(string);
return result;
}
@@ -2648,7 +2648,7 @@
SCM result;
string = xxxgtk_textview_get_text (GTK_TEXT_VIEW(widget));
- result = scm_from_locale_string(string ? string : "");
+ result = scm_from_utf8_string(string ? string : "");
g_free(string);
return result;
}
@@ -2869,7 +2869,7 @@
const gchar * string;
string = gtk_font_button_get_font_name(font_button);
- return (string ? scm_from_locale_string(string) : SCM_BOOL_F);
+ return (string ? scm_from_utf8_string(string) : SCM_BOOL_F);
}
static SCM
@@ -2880,7 +2880,7 @@
string = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
DEBUG("filename %s", string ? string : "(null)");
- result = scm_from_locale_string(string ? string : "");
+ result = scm_from_utf8_string(string ? string : "");
g_free(string);
return result;
}
Modified: gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -172,7 +172,7 @@
if (scm_is_string(item))
{
gchar* s;
- s = gnc_scm_to_locale_string(item);
+ s = gnc_scm_to_utf8_string(item);
if (i == 1)
strings[i] = g_strdup(s);
Modified: gnucash/trunk/src/guile-mappings.h
===================================================================
--- gnucash/trunk/src/guile-mappings.h 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/guile-mappings.h 2013-12-13 20:21:41 UTC (rev 23556)
@@ -20,8 +20,10 @@
#include <libguile.h> /* for SCM_MAJOR_VERSION etc */
/* Give Guile 1.8 a 2.0-like interface */
-#if (SCM_MAJOR_VERSION == 1) && (SCM_MINOR_VERSION <= 8)
+#if (SCM_MAJOR_VERSION < 2)
# define scm_c_string_length scm_i_string_length
+# define scm_from_utf8_string scm_from_locale_string
+# define scm_to_utf8_string scm_to_locale_string
#endif
/* Convenience macros */
Modified: gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/import-export/qif-import/assistant-qif-import.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -2095,7 +2095,7 @@
SCM fix_default = scm_c_eval_string("qif-import:fix-from-acct");
SCM scm_name;
- scm_name = scm_from_locale_string(acct_name ? acct_name : "");
+ scm_name = scm_from_utf8_string(acct_name ? acct_name : "");
scm_call_2(fix_default, wind->selected_file, scm_name);
/* Enable the assistant Forward Button */
@@ -2821,7 +2821,7 @@
wind->cat_map_info,
wind->memo_map_info,
wind->security_hash,
- scm_from_locale_string(currname ? currname : ""),
+ scm_from_utf8_string(currname ? currname : ""),
wind->transaction_status,
progress),
SCM_EOL);
Modified: gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c
===================================================================
--- gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/import-export/qif-import/dialog-account-picker.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -93,7 +93,7 @@
}
if (scm_is_string(SCM_CAR(current)))
- compname = gnc_scm_to_locale_string (SCM_CAR(current));
+ compname = gnc_scm_to_utf8_string (SCM_CAR(current));
else
compname = g_strdup("");
@@ -242,7 +242,7 @@
/* Save the full name and update the map entry. */
g_free(wind->selected_name);
wind->selected_name = fullname;
- scm_call_2(name_setter, wind->map_entry, scm_from_locale_string(fullname));
+ scm_call_2(name_setter, wind->map_entry, scm_from_utf8_string(fullname));
}
gtk_widget_destroy(dlg);
@@ -272,7 +272,7 @@
ACCOUNT_COL_FULLNAME, &wind->selected_name,
-1);
scm_call_2(name_setter, wind->map_entry,
- wind->selected_name ? scm_from_locale_string(wind->selected_name) : SCM_BOOL_F);
+ wind->selected_name ? scm_from_utf8_string(wind->selected_name) : SCM_BOOL_F);
}
else
{
@@ -342,7 +342,7 @@
/* Set the initial account to be selected. */
if (scm_is_string(orig_acct))
- wind->selected_name = gnc_scm_to_locale_string (orig_acct);
+ wind->selected_name = gnc_scm_to_utf8_string (orig_acct);
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-account-picker.glade", "QIF Import Account Picker");
Modified: gnucash/trunk/src/register/ledger-core/split-register-control.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-control.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/register/ledger-core/split-register-control.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -880,7 +880,7 @@
gnc_get_current_book ());
g_assert(pending_trans == trans);
- gnc_copy_trans_onto_trans (auto_trans, trans, FALSE, FALSE);
+ xaccTransCopyOnto (auto_trans, trans);
blank_split = NULL;
if (gnc_split_register_get_default_account (reg) != NULL)
Modified: gnucash/trunk/src/register/ledger-core/split-register.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/register/ledger-core/split-register.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -630,10 +630,9 @@
return NULL;
}
- new_trans = xaccMallocTransaction (gnc_get_current_book ());
+ new_trans = xaccTransClone (trans);
xaccTransBeginEdit (new_trans);
- gnc_copy_trans_onto_trans (trans, new_trans, FALSE, FALSE);
xaccTransSetDatePostedSecsNormalized (new_trans, date);
/* We also must set a new DateEntered on the new entry
* because otherwise the ordering is not deterministic */
Modified: gnucash/trunk/src/report/report-gnome/dialog-custom-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/dialog-custom-report.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/report/report-gnome/dialog-custom-report.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -152,8 +152,8 @@
for (i = 0; !scm_is_null(rpt_guids); i++)
{
GncGUID *guid = guid_malloc ();
- gchar *guid_str = scm_to_locale_string (SCM_CAR(rpt_guids));
- gchar *name = gnc_scm_to_locale_string (scm_call_2(template_menu_name, SCM_CAR(rpt_guids), SCM_BOOL_F));
+ gchar *guid_str = scm_to_utf8_string (SCM_CAR(rpt_guids));
+ gchar *name = gnc_scm_to_utf8_string (scm_call_2(template_menu_name, SCM_CAR(rpt_guids), SCM_BOOL_F));
if (string_to_guid (guid_str, guid))
{
@@ -273,7 +273,7 @@
gchar *new_name)
{
SCM rename_report = scm_c_eval_string("gnc:rename-report");
- SCM new_name_scm = scm_from_locale_string(new_name);
+ SCM new_name_scm = scm_from_utf8_string(new_name);
if (scm_is_null(guid) || !new_name || (*new_name == '\0'))
return;
@@ -300,7 +300,7 @@
if (scm_is_null (guid))
return;
- report_name = gnc_scm_to_locale_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
+ report_name = gnc_scm_to_utf8_string(scm_call_2(template_menu_name, guid, SCM_BOOL_F));
/* we must confirm the user wants to delete their precious custom report! */
if (gnc_verify_dialog(crd->dialog, FALSE, "Are you sure you want to delete %s?", report_name))
@@ -350,7 +350,7 @@
return SCM_EOL;
}
- return scm_from_locale_string (guid_str);
+ return scm_from_utf8_string (guid_str);
}
@@ -380,7 +380,7 @@
guid_str = g_new0 (gchar, GUID_ENCODING_LENGTH+1 );
guid_to_string_buff (guid, guid_str);
- custom_report_run_report(scm_from_locale_string (guid_str), crd);
+ custom_report_run_report(scm_from_utf8_string (guid_str), crd);
}
}
@@ -431,7 +431,7 @@
CustomReportDialog *crd = data;
SCM guid = get_custom_report_selection(crd, _("Unable to change report name."));
SCM unique_name_func = scm_c_eval_string("gnc:report-template-has-unique-name?");
- SCM new_name_scm = scm_from_locale_string(new_text);
+ SCM new_name_scm = scm_from_utf8_string(new_text);
g_object_set(G_OBJECT(crd->namerenderer), "editable", FALSE, NULL);
if (scm_is_null (guid))
@@ -536,7 +536,7 @@
return;
guid = guid_malloc ();
- guid_str = scm_to_locale_string (scm_guid);
+ guid_str = scm_to_utf8_string (scm_guid);
if (!string_to_guid (guid_str, guid))
goto cleanup;
Modified: gnucash/trunk/src/report/report-gnome/dialog-report-column-view.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/dialog-report-column-view.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/report/report-gnome/dialog-report-column-view.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -148,7 +148,7 @@
{
if (scm_is_equal (SCM_CAR(rpt_guids), selection))
row = i;
- name = gnc_scm_to_locale_string (scm_call_2(template_menu_name, SCM_CAR(rpt_guids),
+ name = gnc_scm_to_utf8_string (scm_call_2(template_menu_name, SCM_CAR(rpt_guids),
SCM_BOOL_F));
gtk_list_store_append(store, &iter);
@@ -195,7 +195,7 @@
id = scm_to_int(SCM_CAAR(contents));
this_report = gnc_report_find(id);
- name = gnc_scm_to_locale_string (scm_call_1(report_menu_name, this_report));
+ name = gnc_scm_to_utf8_string (scm_call_1(report_menu_name, this_report));
gtk_list_store_append(store, &iter);
gtk_list_store_set
Modified: gnucash/trunk/src/report/report-gnome/dialog-report-style-sheet.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/dialog-report-style-sheet.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/report/report-gnome/dialog-report-style-sheet.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -241,8 +241,8 @@
if (template_str && name_str)
{
new_ss = scm_call_2(make_ss,
- scm_from_locale_string(template_str),
- scm_from_locale_string(name_str));
+ scm_from_utf8_string(template_str),
+ scm_from_utf8_string(name_str));
}
}
Modified: gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/report/report-gnome/gnc-plugin-page-report.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -1349,7 +1349,7 @@
break;
}
- name = gnc_scm_to_locale_string (scm);
+ name = gnc_scm_to_utf8_string (scm);
choices = g_list_prepend (choices, name);
}
@@ -1398,7 +1398,7 @@
if (choice == SCM_BOOL_T)
type = g_strdup (html_type);
else
- type = gnc_scm_to_locale_string(SCM_CAR (choice));
+ type = gnc_scm_to_utf8_string(SCM_CAR (choice));
/* %s is the type of what is about to be saved, e.g. "HTML". */
title = g_strdup_printf (_("Save %s To File"), type);
Modified: gnucash/trunk/src/report/report-gnome/window-report.c
===================================================================
--- gnucash/trunk/src/report/report-gnome/window-report.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/report/report-gnome/window-report.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -159,7 +159,7 @@
{
ptr = scm_call_1(get_template_name, ptr);
if (scm_is_string(ptr))
- title = gnc_scm_to_locale_string (ptr);
+ title = gnc_scm_to_utf8_string (ptr);
}
}
Modified: gnucash/trunk/src/report/report-system/gnc-report.c
===================================================================
--- gnucash/trunk/src/report/report-system/gnc-report.c 2013-12-13 14:42:47 UTC (rev 23555)
+++ gnucash/trunk/src/report/report-system/gnc-report.c 2013-12-13 20:21:41 UTC (rev 23556)
@@ -157,7 +157,7 @@
if (scm_text == SCM_UNDEFINED || !scm_is_string (scm_text))
return FALSE;
- *data = gnc_scm_to_locale_string (scm_text);
+ *data = gnc_scm_to_utf8_string (scm_text);
return TRUE;
}
More information about the gnucash-changes
mailing list