Selon Tux <[EMAIL PROTECTED]>: > Hello, > I've done some research on UTF-8 support in bash. I think I would be better > to > switch every language file to UTF-8 to avoid current problems with special > characters.
I think the more proper solution is each translation file contains its encoding. > Switching to UTF-8 is very simple: > LC_CTYPE=UTF-8 > echo -ne '\033%G' > > Returning to ISO-8859-15 for example is more complicated, so I've tried this > script: http://www.cl.cam.ac.uk/~mgk25/ucs/setcode > UTF-8 => "LC_CTYPE=UTF-8;setcode" > ISO-8859-15 => "LC_CTYPE=ISO-8859-15;setcode" > Problem : setcode script has no licence: only "share and enjoy"... We may > need > to ask the author to release it under the GPL to use it. > === Best solution (possible??) === > I don't know whether it is possible to create a context to switch to UTF-8 > only as long as scripts are running. > > === Other solution (dirty...) === > OLD_LOCALE=$LC_CTYPE > LC_CTYPE=UTF-8;setcode > trap 'LC_CTYPE=$OLD_LOCALE;setcode' EXIT > ... We modify (1) LC_CTYPE and (2) the terminal properties. It is usefull only for command that write in the terminal. I think it is the simplest way : ProgramWithEcho is replaced by LC_CTYPE=UTF-8 setcode; ProgramWithEcho; setcode Maybe we may create a new shell function :-) function echoWithEnc () { LC_CTYPE=$1 setcode; shift; echo "$@"; setcode; } echoWithEnc fr_FR.UTF-8 $TESTCONNEC_CONNECTION_LOST_MSG Or in the same way function echoWithEnc () { LC_CTYPE=$ENCODING_OF_TRANSLATION setcode; echo "$@"; setcode; } echoWithEnc $TESTCONNEC_CONNECTION_LOST_MSG > > Any comment? Yes. It's work fine with xterm, not with aterm. I think it's a bug of aterm. mcoolive.
