[Konsole-devel] How to switch current gnome-terminal/konsole charset from shell

Robert Knight robertknight at gmail.com
Sun Jan 18 21:10:25 UTC 2009


Konsole allows any profile setting to be changed from the command line using:

konsoleprofile setting=value

eg. konsoleprofile DefaultEncoding=ru_RU.UTF-8

(where 'konsoleprofile' is a very simple shell script which echoes
"ESC]50;$1\a" where $1 is the 'key=value' string)

The names of the available settings and the format of the values are
the same as those saved in the config files
in ~/.kde/share/apps/konsole/*.profile


2009/1/18 Alexander GQ Gerasiov <gq at cs.msu.su>:
> Hi there.
> Many people work in multilingual or at least multicharset environments.
> E.g. sometimes I switch from ru_RU.UTF-8 to ru_RU.KOI8-R and back.
> Other peoples may want to switch from ru_RU.KOI8-R to ru_RU.CP1251.
> The problem not in cyrillic charsets but in situation when user had to
> switch from one charset to another. (May be latin1 <-> utf-8).
> Both and gnome/gtk's VteTerminal and konsole allow user to define
> charset somewhere in menu. That's nice, but annoying. User should not
> only change locale, but also switch something in GUI.
> Is it possible to rule terminal from shell? Sure, there are some ESC
> sequences which should be processed by terminal application.
> I looked trough ISO 2022 and ECMA-48. Wow! Got it! There is some
> ability to choose charsets... Unfortunatly not any charset, but only
> several which are defined in ISO 2022. That's pity.
> But at least it allows to switch terminal to utf-8 ("ESC % G" sequence).
> And digging through sources of VteTerminal and konsole I found that
> they really support this standard.
> But how can I specify charsets other then utf-8?
> In the past there where X11 extension to ISO 2022, which allows to
> specify encoding by "ESC % / N length charset STX". But it's obsolete.
> What can we do? Well, every terminal application for X supports some
> standard extensions. At least specifying window title as it was proposed
> by classic XTerm. So the question is:
> Could we extend standard and use some OSC sequence for this?
> How could this extension be supported both by gnome/kde? Or may be this
> should be proposed to freedesktop.org?
> ====quote====
> Sequence: OSC or ESC ]
> Mnemonic: OSC
> Description: Operating system command
> OSC is used as the opening delimiter of a control string for operating
> system use. The command string following may consist of a sequence of
> bit combinations in the range 00/08 to 00/13 and 02/00 to 07/14.  The
> control string is closed by the terminating delimiter STRING
> TERMINATOR (ST). The interpretation of the command string depends on
> the relevant operating system.
> ====endofquote====
> Something like "ESC ] C ; charset_name BEL (or ST)" would allow us to
> specify charset from shell.
> I could provide patch for both gnome_vte_terminal and konsole if needed.
> But would they include it?
> --
> Best regards,
>  Alexander GQ Gerasiov
>  Contacts:
>  e-mail:    gq at cs.msu.su             Jabber:  gq at jabber.ru
>  Homepage:  http://gq.net.ru         ICQ:     7272757
>  PGP fingerprint: 0628 ACC7 291A D4AA 6D7D  79B8 0641 D82A E3E3 CE1D
> _______________________________________________
> konsole-devel mailing list
> konsole-devel at kde.org
> https://mail.kde.org/mailman/listinfo/konsole-devel

More information about the konsole-devel mailing list