From owner-freebsd-i18n@FreeBSD.ORG Thu Feb 24 22:56:40 2011 Return-Path: Delivered-To: i18n@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A18591065675; Thu, 24 Feb 2011 22:56:40 +0000 (UTC) (envelope-from gabor@kovesdan.org) Received: from server.mypc.hu (server.mypc.hu [87.229.73.95]) by mx1.freebsd.org (Postfix) with ESMTP id 5BA588FC0A; Thu, 24 Feb 2011 22:56:40 +0000 (UTC) Received: from server.mypc.hu (localhost [127.0.0.1]) by server.mypc.hu (Postfix) with ESMTP id 939D614E426E; Thu, 24 Feb 2011 23:40:49 +0100 (CET) X-Virus-Scanned: amavisd-new at server.mypc.hu Received: from server.mypc.hu ([127.0.0.1]) by server.mypc.hu (server.mypc.hu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5fgl44anh58T; Thu, 24 Feb 2011 23:40:47 +0100 (CET) Received: from [193.137.158.146] (unknown [193.137.158.146]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by server.mypc.hu (Postfix) with ESMTPSA id 108C614E412A; Thu, 24 Feb 2011 23:40:46 +0100 (CET) Message-ID: <4D66DE70.9000100@kovesdan.org> Date: Thu, 24 Feb 2011 22:40:48 +0000 From: Gabor Kovesdan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pt-PT; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: current@FreeBSD.org, i18n@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: HEADSUP: BSD iconv coming to the base system with default off X-BeenThere: freebsd-i18n@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD Internationalization Effort List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Feb 2011 22:56:40 -0000 Hi Folks, I've got some time again to keep working on iconv. The last time I posted a patch, there were problems with some ports but apart from this it proved to be quite mature, so I decided to commit it to the base system but the default setting will be disabled. It can be enabled by setting the WITH_ICONV knob but whoever does it will take into account that it may break some ports from being built. However, this change will help me with future work and will also help interested people in getting involved in the testing. The rather big changeset is coming soon. Regards, Gabor Kovesdan From owner-freebsd-i18n@FreeBSD.ORG Fri Feb 25 08:19:54 2011 Return-Path: Delivered-To: freebsd-i18n@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3FD3106564A; Fri, 25 Feb 2011 08:19:53 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 42A3E8FC12; Fri, 25 Feb 2011 08:19:52 +0000 (UTC) Received: by ewy28 with SMTP id 28so548108ewy.13 for ; Fri, 25 Feb 2011 00:19:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:in-reply-to:references :references:date:message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=PDnT7SAqDOYutYIBE2aDjKQK67541wVYK6sRT8wO9NM=; b=EkXQ2U7i8wepb1Kor4vg2GWJqsjSl0Yps78BFmYIEmvFrEEU1SYEKvzz4JYY3dn6Z1 gvszfFrND5qd7LCJdIjaptmqtxhwwYxM6+sM19M03hR1t6qOFfM8Np/qprYn8e99/5M0 oxeEuHKN+1e7/89b0sOxVVZXbBqVr3ZKsEHQ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:date:message-id :user-agent:mime-version:content-type:content-transfer-encoding; b=pE+7TiJSmyX4PRiRjQ3MSOQZdFfEHzowPFqRN8LS/JCkDjLpqyyzDXS6JNMHedMuGU ycerKQZW8Cb7jPQWazdT2AxBK2dLBWHnuv3qIeWP0v7eqxTPtn9UdLBaMxNa6fRsSTRS 0HWNIgohf+M3E0GEaQy6CHJ6iwjoR4NSt0cUg= Received: by 10.213.99.204 with SMTP id v12mr287993ebn.53.1298620104108; Thu, 24 Feb 2011 23:48:24 -0800 (PST) Received: from localhost ([46.182.126.126]) by mx.google.com with ESMTPS id u1sm318102eeh.16.2011.02.24.23.48.19 (version=SSLv3 cipher=OTHER); Thu, 24 Feb 2011 23:48:22 -0800 (PST) From: Anonymous To: Gabor Kovesdan In-Reply-To: <4D66DE70.9000100@kovesdan.org> References: <4C16C5B5.1070308@FreeBSD.org> <867hlzq4lb.fsf@gmail.com> <867hlzufl6.fsf@gmail.com> <4C1A7A57.3000006@FreeBSD.org> <86bpb9z77g.fsf@gmail.com> <4C2F7917.7040900@FreeBSD.org> <86pqz29sy2.fsf@gmail.com> <86mxu4sj0n.fsf@gmail.com> <4C35EF85.6010905@FreeBSD.org> <86lj8ot09d.fsf@gmail.com> <86hbilha0s.fsf@gmail.com> References: <4C16C5B5.1070308@FreeBSD.org> <867hlzq4lb.fsf@gmail.com> <867hlzufl6.fsf@gmail.com> <4C1A7A57.3000006@FreeBSD.org> <86bpb9z77g.fsf@gmail.com> <4C2F7917.7040900@FreeBSD.org> <86pqz29sy2.fsf@gmail.com> <86mxu4sj0n.fsf@gmail.com> <4C35EF85.6010905@FreeBSD.org> <86lj8ot09d.fsf@gmail.com> <4C6A6D0B.4010908@FreeBSD.org> <4D66DE70.9000100@kovesdan.org> Date: Fri, 25 Feb 2011 10:48:13 +0300 Message-ID: <86wrko5zcy.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, freebsd-i18n@FreeBSD.org Subject: Re: HEADSUP: BSD iconv coming to the base system with default off X-BeenThere: freebsd-i18n@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD Internationalization Effort List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2011 08:19:54 -0000 Anonymous writes in "[CFT] BSDL iconv in base system": > I guess gettext hanging is due to ABI incompatibility, too. > > $ cat foo.po > msgid "" > msgstr "" > "Content-Type: text/plain; charset=3DUTF-8\n" > "Content-Transfer-Encoding: 8bit\n" > > msgid "don=E2=80=99t" > msgstr "do not" > > $ msgmerge foo.po /dev/null # GNU iconv > . done. > msgid "" > msgstr "" > "Content-Type: text/plain; charset=3DUTF-8\n" > "Content-Transfer-Encoding: 8bit\n" > > #~ msgid "don=E2=80=99t" > #~ msgstr "do not" > > $ msgmerge foo.po /dev/null # BSD iconv > . done. > msgid "" > load: 0.10 cmd: msgmerge 65132 [runnable] 2.74r 2.72u 0.00s 23% 2844k > ^C > (gdb) bt > #0 _citrus_iconv_none_iconv_convert (ci=3D0x80f00f190, in=3D0x7fffffff= 0b40, inbytes=3D0x7fffffff0b40, out=3D0x7fffffff0b48, outbytes=3D0x7fffffff= 0b50, flags=3D0, > invalids=3D0x7fffffff0aa0) at /usr/src/lib/libiconv_modules/iconv_n= one/citrus_iconv_none.c:119 > len =3D 1 > e2big =3D 0 > #1 0x00000008064b9142 in _citrus_iconv_convert (cv=3D0x80f00f190, in= =3D0x7fffffff0b38, inbytes=3D0x7fffffff0b40, out=3D0x7fffffff0b48, outbytes= =3D0x7fffffff0b50, > flags=3D0, nresults=3D0x7fffffff0aa0) at citrus_iconv.h:60 > No locals. > #2 0x00000008064b90b2 in libiconv (handle=3D0x80f00f190, in=3D0x7fffff= ff0b38, szin=3D0x7fffffff0b40, out=3D0x7fffffff0b48, szout=3D0x7fffffff0b50) > at /usr/src/lib/libc/iconv/iconv.c:147 > ret =3D 0 > err =3D 0 > #3 0x00000008036db20a in wrap (mp=3D0x80f020400, stream=3D0x80f0123c0,= line_prefix=3D0x0, extra_indent=3D0, css_class=3D0x80370a2f0 "msgstr", > name=3D0x80370a3a9 "msgstr", value=3D0x80f01f0b0 "Content-Type: tex= t/plain; charset=3DUTF-8\nContent-Transfer-Encoding: 8bit\n", do_wrap=3Dund= ecided, > page_width=3D79, charset=3D0x7fffffff0d80 "UTF-8") at write-po.c:724 > #4 0x00000008036dcbdd in message_print (mp=3D0x80f020400, stream=3D0x8= 0f0123c0, charset=3D0x7fffffff0d80 "UTF-8", page_width=3D79, blank_line=3Df= alse, debug=3Dfalse) > at write-po.c:1283 > #5 0x00000008036dd736 in msgdomain_list_print_po (mdlp=3D0x80f0071c0, = stream=3D0x80f0123c0, page_width=3D79, debug=3Dfalse) at write-po.c:1511 > #6 0x00000008036d8859 in msgdomain_list_print (mdlp=3D0x80f0071c0, fil= ename=3D0x80370a0a6 "standard output", output_syntax=3D0x40d7b0, force=3Dfa= lse, debug=3Dfalse) > at write-catalog.c:246 > #7 0x0000000000403604 in main (argc=3D3, argv=3D0x7fffffff0ff0) at msg= merge.c:463 Above test still hangs as of r219023M with similar trace. Should I file a PR or bsdiconv isn't supposed to work in such a way? > > It's a bit tweaked version, though. > > %% > Index: devel/gettext/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /a/.cvsup/ports/devel/gettext/Makefile,v > retrieving revision 1.87 > diff -u -p -r1.87 Makefile > --- devel/gettext/Makefile 3 Jun 2010 09:46:38 -0000 1.87 > +++ devel/gettext/Makefile 23 Aug 2010 10:04:26 -0000 > @@ -28,7 +28,7 @@ CONFIGURE_ENV=3D ACLOCAL=3D"${TRUE}" \ > AUTOHEADER=3D"${TRUE}" \ > MAKEINFO=3D"makeinfo --no-split" \ > CPPFLAGS=3D"-I${LOCALBASE}/include" \ > - LDFLAGS=3D"-L${LOCALBASE}/lib" \ > + LDFLAGS=3D"-L${LOCALBASE}/lib -liconv" \ > EMACS=3D"no" > CONFIGURE_ARGS=3D --disable-csharp --disable-threads --disable-openmp \ > --with-included-gettext --with-included-glib \ > @@ -65,6 +65,8 @@ pre-extract: > .endif >=20=20 > post-patch: > + @${REINPLACE_CMD} 's/-DENABLE_RELOCATABLE=3D1//' \ > + ${WRKSRC}/gettext-runtime/intl/Makefile.in > @${FIND} ${WRKSRC} -name configure -print | ${XARGS} \ > ${REINPLACE_CMD} -e 's|mkdir gmkdir|mkdir|' > .if defined (NOPORTDOCS) > %% From owner-freebsd-i18n@FreeBSD.ORG Fri Feb 25 14:53:13 2011 Return-Path: Delivered-To: freebsd-i18n@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78673106566B; Fri, 25 Feb 2011 14:53:13 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id A92018FC1B; Fri, 25 Feb 2011 14:53:12 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id B8F373593A7; Fri, 25 Feb 2011 15:53:11 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id AB8DE1737B; Fri, 25 Feb 2011 15:53:11 +0100 (CET) Date: Fri, 25 Feb 2011 15:53:11 +0100 From: Jilles Tjoelker To: freebsd-hackers@freebsd.org, freebsd-i18n@freebsd.org Message-ID: <20110225145311.GA4423@stack.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Basic UTF-8 support for sh(1) X-BeenThere: freebsd-i18n@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD Internationalization Effort List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2011 14:53:13 -0000 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here is a patch that adds basic UTF-8 support to sh(1). This is enabled if the locale is set appropriately. Features: * ${#var} counts codepoints. (Really, bytes with (b & 0xc0) != 0x80.) * ?, [...] patterns match codepoints instead of bytes. They do not match invalid sequences. This is so that ${var#?} removes the first codepoint, not the first byte. However, * continues to match any string and an invalid sequence matches an identical invalid sequence. (This differs from fnmatch(3).) Internal: * CTL* bytes are moved to bytes that cannot occur in UTF-8 so that mbrtowc(3) can be used directly. The new locations do occur in iso-8859-* encodings. Limitations: * Only UTF-8 support is added, not any other multibyte encodings. I do not want to bloat up sh with mbrtowc(3) and similar everywhere. * Invalid sequences may not be handled as desired. It seems aborting on invalid UTF-8 sequences would break things, so they are let through. This also avoids bloating the code up with checking everywhere. * There is no special treatment for combining characters, accented letters may match ? or ?? or even more depending on normalization form. This matches other code in FreeBSD and is usually good enough because normalization forms that use as few codepoints as possible tend to be used. * IFS remains byte-based as in ksh93 (but unlike bash and zsh). * Our version of libedit does not support UTF-8 so sh will still be rather unpleasant to use interactively with characters not in us-ascii. Is this useful and worth the (small) bloat? A somewhat related feature is support for \uNNNN and \UNNNNNNNN sequences in $'...' (this will be added to POSIX, see http://austingroupbugs.net/view.php?id=249 and I plan to add it to sh). Ideally, these are converted using iconv(3) but as long as it is not unconditionally available in base or if it is not supposed to be used, the codepoints can be encoded in UTF-8 for UTF-8 locales, leaving other locales with question marks. -- Jilles Tjoelker --ikeVEW9yuYc//A+q Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="sh-utf8.patch" Index: parser.h =================================================================== --- parser.h (revision 218371) +++ parser.h (working copy) @@ -34,16 +34,16 @@ */ /* control characters in argument strings */ -#define CTLESC '\201' -#define CTLVAR '\202' -#define CTLENDVAR '\203' -#define CTLBACKQ '\204' +#define CTLESC '\300' +#define CTLVAR '\301' +#define CTLENDVAR '\371' +#define CTLBACKQ '\372' #define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ /* CTLBACKQ | CTLQUOTE == '\205' */ -#define CTLARI '\206' -#define CTLENDARI '\207' -#define CTLQUOTEMARK '\210' -#define CTLQUOTEEND '\211' /* only for ${v+-...} */ +#define CTLARI '\374' +#define CTLENDARI '\375' +#define CTLQUOTEMARK '\376' +#define CTLQUOTEEND '\377' /* only for ${v+-...} */ /* variable substitution byte (follows CTLVAR) */ #define VSTYPE 0x0f /* type of variable substitution */ Index: sh.1 =================================================================== --- sh.1 (revision 218467) +++ sh.1 (working copy) @@ -2510,4 +2510,7 @@ was originally written by .Sh BUGS The .Nm -utility does not recognize multibyte characters. +utility does not recognize multibyte characters other than UTF-8. +The line editing library +.Xr editline 3 +does not recognize multibyte characters. Index: expand.c =================================================================== --- expand.c (revision 218371) +++ expand.c (working copy) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * Routines to expand arguments to commands. We have to deal with @@ -111,16 +112,16 @@ static void addfname(char *); static struct strlist *expsort(struct strlist *); static struct strlist *msort(struct strlist *, int); static char *cvtnum(int, char *); -static int collate_range_cmp(int, int); +static int collate_range_cmp(wchar_t, wchar_t); static int -collate_range_cmp(int c1, int c2) +collate_range_cmp(wchar_t c1, wchar_t c2) { - static char s1[2], s2[2]; + static wchar_t s1[2], s2[2]; s1[0] = c1; s2[0] = c2; - return (strcoll(s1, s2)); + return (wcscoll(s1, s2)); } /* @@ -665,6 +666,7 @@ evalvar(char *p, int flag) int special; int startloc; int varlen; + int varlenb; int easy; int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR); @@ -712,8 +714,15 @@ again: /* jump here after setting a variable with if (special) { varvalue(var, varflags & VSQUOTE, subtype, flag); if (subtype == VSLENGTH) { - varlen = expdest - stackblock() - startloc; - STADJUST(-varlen, expdest); + varlenb = expdest - stackblock() - startloc; + varlen = varlenb; + if (localeisutf8) { + val = stackblock() + startloc; + for (;val != expdest; val++) + if ((*val & 0xC0) == 0x80) + varlen--; + } + STADJUST(-varlenb, expdest); } } else { char const *syntax = (varflags & VSQUOTE) ? DQSYNTAX @@ -721,7 +730,9 @@ again: /* jump here after setting a variable with if (subtype == VSLENGTH) { for (;*val; val++) - varlen++; + if (!localeisutf8 || + (*val & 0xC0) != 0x80) + varlen++; } else { if (quotes) @@ -1367,6 +1378,23 @@ msort(struct strlist *list, int len) +static wchar_t +get_wc(const char **p) +{ + wchar_t c; + int chrlen; + + chrlen = mbtowc(&c, *p, 4); + if (chrlen == 0) + return 0; + else if (chrlen == -1) + c = *(*p)++; + else + *p += chrlen; + return c; +} + + /* * Returns true if the pattern matches the string. */ @@ -1376,6 +1404,7 @@ patmatch(const char *pattern, const char *string, { const char *p, *q; char c; + wchar_t wc, wc2; p = pattern; q = string; @@ -1394,7 +1423,11 @@ patmatch(const char *pattern, const char *string, case '?': if (squoted && *q == CTLESC) q++; - if (*q++ == '\0') + if (localeisutf8) + wc = get_wc(&q); + else + wc = *q++; + if (wc == '\0') return 0; break; case '*': @@ -1424,7 +1457,7 @@ patmatch(const char *pattern, const char *string, case '[': { const char *endp; int invert, found; - char chr; + wchar_t chr; endp = p; if (*endp == '!' || *endp == '^') @@ -1445,8 +1478,11 @@ patmatch(const char *pattern, const char *string, p++; } found = 0; - chr = *q++; - if (squoted && chr == CTLESC) + if (squoted && *q == CTLESC) + q++; + if (localeisutf8) + chr = get_wc(&q); + else chr = *q++; if (chr == '\0') return 0; @@ -1456,19 +1492,27 @@ patmatch(const char *pattern, const char *string, continue; if (c == CTLESC) c = *p++; + if (localeisutf8 && c & 0x80) { + p--; + wc = get_wc(&p); + } else + wc = c; if (*p == '-' && p[1] != ']') { p++; while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; - if ( collate_range_cmp(chr, c) >= 0 - && collate_range_cmp(chr, *p) <= 0 + if (localeisutf8) + wc2 = get_wc(&p); + else + wc2 = *p++; + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 ) found = 1; - p++; } else { - if (chr == c) + if (chr == wc) found = 1; } } while ((c = *p++) != ']'); Index: main.c =================================================================== --- main.c (revision 218371) +++ main.c (working copy) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); int rootpid; int rootshell; struct jmploc main_handler; +int localeisutf8; static void read_profile(const char *); static char *find_dot_file(char *); @@ -96,6 +97,7 @@ main(int argc, char *argv[]) char *shinit; (void) setlocale(LC_ALL, ""); + updatecharset(); state = 0; if (setjmp(main_handler.loc)) { switch (exception) { Index: var.c =================================================================== --- var.c (revision 218371) +++ var.c (working copy) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); */ #include +#include #include "shell.h" #include "output.h" @@ -361,6 +362,7 @@ setvareq(char *s, int flags) if ((vp->flags & VEXPORT) && localevar(s)) { change_env(s, 1); (void) setlocale(LC_ALL, ""); + updatecharset(); } INTON; return; @@ -379,6 +381,7 @@ setvareq(char *s, int flags) if ((vp->flags & VEXPORT) && localevar(s)) { change_env(s, 1); (void) setlocale(LC_ALL, ""); + updatecharset(); } INTON; } @@ -480,6 +483,7 @@ bltinsetlocale(void) if (loc != NULL) { setlocale(LC_ALL, loc); INTON; + updatecharset(); return; } locdef = bltinlookup("LANG", 0); @@ -491,6 +495,7 @@ bltinsetlocale(void) setlocale(locale_categories[i], loc); } INTON; + updatecharset(); } /* @@ -505,13 +510,25 @@ bltinunsetlocale(void) for (lp = cmdenviron ; lp ; lp = lp->next) { if (localevar(lp->text)) { setlocale(LC_ALL, ""); + updatecharset(); return; } } INTON; } +/* + * Update the localeisutf8 flag. + */ +void +updatecharset(void) +{ + char *charset; + charset = nl_langinfo(CODESET); + localeisutf8 = !strcmp(charset, "UTF-8"); +} + /* * Generate a list of exported variables. This routine is used to construct * the third argument to execve when executing a program. @@ -656,6 +673,7 @@ exportcmd(int argc, char **argv) if ((vp->flags & VEXPORT) && localevar(vp->text)) { change_env(vp->text, 1); (void) setlocale(LC_ALL, ""); + updatecharset(); } goto found; } @@ -850,6 +868,7 @@ unsetvar(const char *s) if ((vp->flags & VEXPORT) && localevar(vp->text)) { change_env(s, 0); setlocale(LC_ALL, ""); + updatecharset(); } vp->flags &= ~VEXPORT; vp->flags |= VUNSET; Index: var.h =================================================================== --- var.h (revision 218371) +++ var.h (working copy) @@ -81,6 +81,8 @@ extern struct var vhistsize; extern struct var vterm; #endif +extern int localeisutf8; + /* * The following macros access the values of the above variables. * They have to skip over the name. They return the null string @@ -112,6 +114,7 @@ char *lookupvar(const char *); char *bltinlookup(const char *, int); void bltinsetlocale(void); void bltinunsetlocale(void); +void updatecharset(void); char **environment(void); int showvarscmd(int, char **); int exportcmd(int, char **); --ikeVEW9yuYc//A+q--