Hi,

>for better support of the UTF-8 mode of the mksh I've done a small
>patch which enables the mksh to change to UTF-8 mode even if the
>locale is changed at runtime ', e.g in ~/.profile, ~/.mkshrc or
>in the system wide /etc/profile.  The attached patch is for R54.

locale tracking is on the TODO. There's one problem with the
patch (which technically is very well done):

mksh (well, lksh -o posix) is only a POSIX-compatible shell
in the C locale. I fear complaints from users.

I do not wish to have mksh use locale tracking at this point,
before this has been thought out more. It does not use the locale
internally at all anyway. (Hm, the OS' strerror() and friends
might, which *also* requires consideration.) There's also an
additional thing in MirBSD to take care of first...

The manpage documents that...

        case ${KSH_VERSION:-} in
        *MIRBSD KSH*|*LEGACY KSH*)
                case ${LC_ALL:-${LC_CTYPE:-${LANG:-}}} in
                *[Uu][Tt][Ff]8*|*[Uu][Tt][Ff]-8*) set -U ;;
                *) set +U ;;
                esac ;;
        esac

... can be used to make set ±U consistent with the current
user locale (UTF-8 or not-UTF-8, anyway). This snippet is
in sh; an mksh-specific example (from Debian skel/.mkshrc)
would be:

\\builtin set -U; [[ ${LC_ALL:-${LC_CTYPE:-${LANG:-}}} = *[Uu][Tt][Ff]?(-)8* ]] 
|| \\builtin set +U

There are multiple issues bearing consideration; I was, at
some point in time, even considering a full rewrite that
would use the system POSIX locale functions if available
(they're not everywhere), possibly extending them with
UTF-8 support (which is not everywhere). Of course, in the
GNU/Linux camp, this would be easy, but mksh supports a ton
of OSes...

I'd ask you to include the shell snippet from above into a
late shell rc file at the current point in time, for users'
consistencies (runtime changes to LC_* aren't effective in
mksh on any other platform currently, so this would be in-
consistent), but if you can't do that...

bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
        -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

Reply via email to