}
+/*
+ * Unicode helper
+ */
+static void reinit_unicode_for_hush(void)
+{
+ /* Unicode support should be activated even if LANG is set
+ * _during_ shell execution, not only if it was set when
+ * shell was started. Therefore, re-check LANG every time:
+ */
+ const char *s = get_local_var_value("LC_ALL");
+ if (!s) s = get_local_var_value("LC_CTYPE");
+ if (!s) s = get_local_var_value("LANG");
+ reinit_unicode(s);
+}
+
+
/*
* in_str support
*/
/* Enable command line editing only while a command line
* is actually being read */
do {
- /* Unicode support should be activated even if LANG is set
- * _during_ shell execution, not only if it was set when
- * shell was started. Therefore, re-check LANG every time:
- */
- const char *s = get_local_var_value("LC_ALL");
- if (!s) s = get_local_var_value("LC_CTYPE");
- if (!s) s = get_local_var_value("LANG");
- reinit_unicode(s);
-
+ reinit_unicode_for_hush();
G.flag_SIGINT = 0;
/* buglet: SIGINT will not make new prompt to appear _at once_,
* only after <Enter>. (^C will work) */
/* Handle any expansions */
if (exp_op == 'L') {
+ reinit_unicode_for_hush();
debug_printf_expand("expand: length(%s)=", val);
- val = utoa(val ? strlen(val) : 0);
+ val = utoa(val ? unicode_strlen(val) : 0);
debug_printf_expand("%s\n", val);
} else if (exp_op) {
if (exp_op == '%' || exp_op == '#') {