Selon Tux <[EMAIL PROTECTED]>:
> Le Lundi 20 Décembre 2004 02:33, [EMAIL PROTECTED] a écrit :
> > I think the more proper solution is each translation file
> > contains its encoding.
> But it may be simpler for us to use UTF-8 as we don't have to ask
> contributors
> to give us there local encoding. Moreover, I didn't succeed in displaying
> polish characters in konsole (polish encoding is cp-1250). Using UTF8, I only
> have to switch font to "unicode" and it works.
> note : I just discovered that "echo -ne '\033%@'" disable UTF-8.
We must know their local encoding to recode the file in UTF-8.
And we can add the good line in each translation line :
CODING=UTF-8
ou CODING=ISO-8859-1
ou ...
> ===== current system =====
> * example
> nothing to do
> * problems
> - difficult for maintainers
>
> ===== 1st solution : switch the terminal to UTF-8 (manual) =====
> * example
> function doInUtf8 () { echo -ne '\033%G' ; $@ ; echo -ne '\033%@' ; }
> doInUtf8 diff pl pl.old
> * problems
> - unicode doesn't work in aterm and rxvt
> - if the terminal was already in UTF-8, this command disable it. I've tried
> the command "vt-is-UTF8" but it always return "Single-byte char mode."
function doInUtf8 () {
case $TERM in
xterm ) if [ `locale charmap` = UTF-8 ]; then
"$@"
else echo -ne '\033%G' ; "$@" ; echo -ne '\033%@'
fi ;;
aterm | rxvt ) "$@" ;; # BUG ? If we use CONDING variable, it's as before
* ) "$@" ;; # BUG ? Idem
esac;
}
> ===== 2nd solution : switch the terminal to UTF-8 (setcode) =====
We don't need of setcode.
> ===== 3rd solution : convert strings to local encoding =====
> * example
> function doFromUtf8 () { $@ | iconv -fUTF-8 ; }
> * problems
> - is iconv available in all distribs?
> - "--to-code" parameter is not marqued as optionnal in iconv man page (but it
> works)
> - maybe it should never happened, but if a character is not available in
> target encoding, iconv quits returning "illegal input sequence at
> position..."
The good solution for me. I think iconv exists anywhere.
If we use CODING variable, it become :
function doFromUtf8 () { $@ | iconv -f$CODING ; }
> I'd like to use the first solution but it requires us to find how to detect
> whether the terminal is already in UTF-8.
>
> _____
> Tux
>