UTF-8 / cp-1252 curiousness

Michael Mauch michael.mauch at gmx.de
Tue Jul 1 19:55:48 BST 2008


Andrew Mason wrote:

> 1) can i get konsole to set the session encoding to be that of the
> server/machine that i am connecting to ?

Do you use ssh? If you know for which machines you need to use the other
encoding, you could do something like this:

alias console_utf8='printf "\\033%%G"'
alias console_8bit='printf "\\033%%@"'
# see "man console_codes" (works also in the KDE konsole)

# for some hosts, switch to 8 bit console
ssh ()
{
  case $1 in
    *hostname|*other_hostname)
        console_8bit
	      command ssh "$@"
        console_utf8
	      ;;
    *)  command ssh "$@";;
  esac
}

> 2) is it possible to work out the encoding of a file ?

Not for all encodings, but for utf-8 vs. "that 8 bit encoding that we
use here normally" it shouldn't be a problem with iconv:

iconv -f utf8 -t WINDOWS-1252 "$1" >/dev/null ||
  echo "not an UTF-8 file that can be converted to CP1252"

... where "$1" should be your filename.

> 3) if so it possible to get kate to open the file as the encoding that
> it is currently?

I don't know, sorry.

Regards...
                Michael

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list