On 6/5/17 6:39 PM, George wrote:

> If Bash did go the route of using the locale to set the character encoding of 
> a script, I think it would be best to have a mechanism a script can use
> to define the character encoding for the whole script file up front, rather 
> than setting LC_CTYPE to procedurally change the behavior of the shell.

A script can use an assignment to LC_CTYPE (or LC_ALL, or LANG) at the
beginning of a script to "define the character encoding for the whole
script file up front."

Doing this with "source" is a little more problematic, because
fundamentally shell variable names are simply strings of bytes. If you
change the locale between defining a shell variable and referencing it,
possibly multiple times, you're going to have a character set problem.
There are tools like iconv that can help you with that, but that's a
clumsy solution.

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

Reply via email to