should add a set_default_encoding() to tell what '\033%@' switches to
@egmontkob
Submitted by Egmont Koblinger Link to original bug (#359961)
Description
I'm currently creating a larger Gtk+ application that contains a vte widget as a part of it where I can ssh to a remote machine. The remote machine doesn't necessarily has the same charset as my host, so it's configurable within the application. (Think of a kind of "putty" where you pre-define connection details including the encoding.)
I can set the desired encoding (e.g. iso-8859-2) with vte_terminal_set_encoding(), but if an application requests to switch to UTF-8 mode ('\033%G') and later to switch back ('\033%@'), vte does not switch back to my desired encoding, it switches to the locale's encoding, which is definitely not what I need. (If I configured the 'iso-8859-2' charset in my putty-like application, I'd expect '\033%@' to switch back to 'iso-8859-2', no matter what my locale is.)
Changing the process's locale (or at least LC_CTYPE) is not a good solution for two reasons. First, not all the valid encodings have a corresponding locale, and even for those that have, there's no sane way to find it. Second, I use locales in other parts of my app and those would start misbehaving if I changed the locale.
So I think there should be a way to specify the character set '\033%@' switches to. For this purpose I recommend adding vte_terminal_{set,get}_default_endocing() functions. This default encoding could be initialized to the locale's encoding, this way vte remains perfectly backward compatible.
Another possible approach would be to extend the 'encoding-changed' signal. It could have an argument telling where this signal originates from, and if it's coming from the terminal, which of these escape sequences wat printed. Then of course the 'encoding-changed' signal should be emitted even when the child process requests a change to the same character set. (Currently this signal is not emitted if the child process prints one of these escape sequences, but the new charset is the same as the old one. So I don't even get notified if the child prints a '\033%@' and my system locale is UTF-8. With this modification I'd be notified of these events and hence I could manually set whatever charset I need.) Well, I think vte_set_terminal_default_encoding() would be a cleaner way.
Version: 0.14.x
Resolution: RESOLVED OBSOLETE