From: John Darrington Date: Thu, 2 Apr 2009 02:26:03 +0000 (+0800) Subject: Allow non-ascii characters to be entered as variable names. X-Git-Tag: v0.7.3~182 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae1be0785be76a86b0d0ace1ec820c2a4f3e313d;p=pspp-builds.git Allow non-ascii characters to be entered as variable names. Previously, only ascii could be used in the name of a variable, so the variable sheet did not bother converting. Now we have to convert the encoding. --- diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c index b64bc64e..092de58c 100644 --- a/src/ui/gui/psppire-var-store.c +++ b/src/ui/gui/psppire-var-store.c @@ -467,14 +467,15 @@ psppire_var_store_set_string (PsppireSheetModel *model, { case PSPPIRE_VAR_STORE_COL_NAME: { - int i; - /* Until non-ascii in variable names is better managed, - simply refuse to allow them to be entered. */ - for (i = 0 ; i < strlen (text) ; ++i ) - if (!g_ascii_isprint (text[i])) - return FALSE; - return psppire_dict_rename_var (var_store->dict, pv, text); - break; + gboolean ok; + char *s = recode_string (psppire_dict_encoding (var_store->dict), + UTF8, + text, -1); + + ok = psppire_dict_rename_var (var_store->dict, pv, s); + + free (s); + return ok; } case PSPPIRE_VAR_STORE_COL_COLUMNS: if ( ! text) return FALSE;