bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: Please allow unicode ID chars in identifiers


From: Chet Ramey
Subject: Re: RFE: Please allow unicode ID chars in identifiers
Date: Tue, 13 Jun 2017 20:06:50 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 6/13/17 5:00 PM, Greg Wooledge wrote:
> On Tue, Jun 13, 2017 at 04:44:08PM -0400, tetsujin@scope-eye.net wrote:
>> For that to work, basically the character encoding used to interpret
>> the script should be (potentially) distinct from the one used to
>> interact with the rest of the system.
>>
>> ...But that gets complicated: the shell would need to interpret the
>> script in its locale of origin, but still respect the locale for other
>> matters of I/O. [...]
> 
> The main issue here is that the author's locale may not *exist* on the
> user's machine.  There may not be any way for bash to determine which
> non-ASCII characters constitute "letters" in the author's locale.

That's quite true. If that's important to the author, he can use a shell
function like this to ensure that the script can set the locale
appropriately.

cklocale()
{
        local lc_ctype=$(locale | grep ^LC_CTYPE=)
        eval local ct=${lc_ctype#*=}

        case $ct in
        $1)     return 0 ;;
        *)      return 1 ;;
        esac
}

That works with Mac OS X, where the output of locale(1) is a series of
shell assignment statements with quoted values; your mileage may vary, of
course.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]