Version: 1.6 (using KDE 3.5.1, PLD Linux Distribution) Compiler: gcc version 3.3.6 (PLD Linux) OS: Linux (x86_64) release 2.6.13.4-1 $ echo $KONSOLE_DCOP_SESSION DCOPRef(konsole-21255,session-3) $ dcop $KONSOLE_DCOP_SESSION encoding ISO 8859-15 $ dcop $KONSOLE_DCOP_SESSION setEncoding UTF-8 $ dcop $KONSOLE_DCOP_SESSION encoding ISO 8859-15 should be: UTF-8 i tried also in form: $ dcop konsole-21255 session-3 setEncoding UTF-8 it worked when browsing to the session with 'kdcop' it also worked when changing different things, like sessionName
Yea, the encoding handling is awkward in 3.5.x. I'm not sure I can get this in for the 3.5.x series....
SVN commit 540465 by hindenburg: Fix DCOP call setEncoding. I pray KDE4 will have better encoding coding. BUG: 120998 M +25 -44 konsole.cpp --- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #540464:540465 @@ -845,6 +845,7 @@ } } +// Called via menu void Konsole::slotSetEncoding() { if (!se) return; @@ -2612,9 +2613,7 @@ activateSession(oldSession); } -// Set session encoding; don't use any menu items. -// System's encoding list may change, so search for encoding string. -// FIXME: A lot of duplicate code from slotSetSessionEncoding +// Called by newSession and DCOP function below void Konsole::setSessionEncoding( const QString &encoding, TESession *session ) { if ( encoding.isEmpty() ) @@ -2632,58 +2631,39 @@ // Encoding was found; now try to figure out which Encoding menu item // it corresponds to. int i = 0; + bool found_encoding = false; QStringList encodingNames = KGlobal::charsets()->descriptiveEncodingNames(); - QStringList::Iterator it = encodingNames.begin(); - while ( it != encodingNames.end() && - KGlobal::charsets()->encodingForName(*it) != encoding ) + QStringList::ConstIterator it = encodingNames.begin(); + QString t_encoding = encoding.lower(); + + while ( it != encodingNames.end() && !found_encoding ) { + if ( QString::compare( KGlobal::charsets()->encodingForName(*it), + t_encoding ) == 0 ) { + found_encoding = true; + } i++; it++; } - i++; // Take into account the first entry: Default - //kdDebug()<<"setSessionEncoding="<<encoding<<"; "<<i<<endl; + // BR114535 : Remove jis7 due to infinite loop. + if ( enc == "jis7" ) { + kdWarning()<<"Encoding Japanese (jis7) currently does not work! BR114535"<<endl; + return; + } - session->setEncodingNo( i ); - session->getEmulation()->setCodec(qtc); - if (se == session) + if ( found_encoding ) + { + session->setEncodingNo( i ); + session->getEmulation()->setCodec(qtc); + if (se == session) activateSession(se); - + } } +// Called via DCOP only void Konsole::slotSetSessionEncoding(TESession *session, const QString &encoding) { - if (!selectSetEncoding) - makeGUI(); - - if ( !selectSetEncoding ) // when action/settings=false - return; - - QStringList items = selectSetEncoding->items(); - - QString enc; - unsigned int i = 0; - for(QStringList::ConstIterator it = items.begin(); - it != items.end(); ++it, ++i) - { - if ((*it).find(encoding) != -1) - { - enc = *it; - break; - } - } - if (i >= items.count()) - return; - - bool found = false; - enc = KGlobal::charsets()->encodingForName(enc); - QTextCodec * qtc = KGlobal::charsets()->codecForName(enc, found); - if(!found) - return; - - session->setEncodingNo( i + 1 ); // Take into account Default - session->getEmulation()->setCodec(qtc); - if (se == session) - activateSession(se); + setSessionEncoding( encoding, session ); } void Konsole::slotGetSessionSchema(TESession *session, QString &schema) @@ -3575,6 +3555,7 @@ if (s) setSchema(s); } +// Called via main.cpp for session manager. void Konsole::setEncoding(int index) { if ( selectSetEncoding ) {
Still no working, KDE 3.5.9 and Ubuntu Hardy: kurppa@lanka:~$ kwin --version Qt: 3.3.8b KDE: 3.5.9 KWin: 3.0 kurppa@lanka:~$ lsb_release -r Release: 8.04 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding ISO-8859-1 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding UTF-8 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding ISO-8859-15 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding iso-8859-15 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding ISO-8859-15 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding UTF-8 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$ dcop konsole-29509 session-1 setEncoding utf-8 kurppa@lanka:~$ dcop konsole-29509 session-1 encoding ISO 8859-2 kurppa@lanka:~$