<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>114535</bug_id>
          
          <creation_ts>2005-10-16 22:47:33 +0000</creation_ts>
          <short_desc>Using jis7 encoding causes the entire Konsole to freeze.</short_desc>
          <delta_ts>2011-07-30 13:34:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konsole</product>
          <component>general</component>
          <version>1.6.6</version>
          <rep_platform>Debian testing</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>LATER</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Capel">wot.narg</reporter>
          <assigned_to name="Konsole Bugs">konsole-bugs-null</assigned_to>
          <cc>adaptee</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>381945</commentid>
    <comment_count>0</comment_count>
    <who name="David Capel">wot.narg</who>
    <bug_when>2005-10-16 22:47:33 +0000</bug_when>
    <thetext>Version:           1.5.2 and 1.6 at least (using KDE KDE 3.4.91)
Installed from:    Debian testing/unstable Packages
Compiler:          gcc 4.0 
OS:                Linux

Changing to the jis7 encoding in konsole causes it to freeze once you enter a command.


To reproduce:
1. Open Konsole.
2. Settings &gt; Encoding &gt; jis7
3. type something (anything :p)
4. KER-Freeze.

I&apos;m using kde3.5b1 kubuntu debs, with konsole version 1.6, but the person who found it first (and wanted me to report it :p) is using konsole version 1.5.2 on kde 3.4.3. Others in the #kde channel on freenode could reproduce it also.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>381953</commentid>
    <comment_count>1</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-10-16 23:10:58 +0000</bug_when>
    <thetext>Yep, it freezes using 100% CPU.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>384269</commentid>
    <comment_count>2</comment_count>
    <who name="Steven P. Ulrick">lists</who>
    <bug_when>2005-10-24 23:55:43 +0000</bug_when>
    <thetext>Same here.  Only goes to about 92.5% CPU, though :)  My version of Konsole is 1.6 from SVN Branch 3.5.  All the rest of my KDE is compiled from Branch 3.5 as well.  Also, I am running Fedora Core 3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>384306</commentid>
    <comment_count>3</comment_count>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2005-10-25 02:58:38 +0000</bug_when>
    <thetext>Bug in the code, but I don&apos;t know whose fault it is.

297     void TEmulation::onRcvBlock(const char *s, int len)
298     {
299       emit notifySessionState(NOTIFYACTIVITY);
300
301       bulkStart();
302       for (int i = 0; i &lt; len; i++)
303       {
304
305         QString result = decoder-&gt;toUnicode(&amp;s[i],1);
306         int reslen = result.length();
307
308         // If we get a control code halfway a multi-byte sequence
309         // we flush the decoder and continue with the control code.
310         if ((s[i] &lt; 32) &amp;&amp; (s[i] &gt; 0))
311         {
312            // Flush decoder
313            while(!result.length())
314               result = decoder-&gt;toUnicode(&amp;s[i],1);
315            reslen = 1;
316            result.setLength(reslen);
317            result[0] = QChar(s[i]);
318         }

decoder is of type QJisDecoder.

The problem is that:
1) decoder is in state &quot;esc&quot;
2) decoder-&gt;toUnicode(&quot;\033&quot;,1) returns an empty QString
3) the loop in lines 313 and 314 is infinite if the decoder returns an empty string.

Maybe an increment on i was forgotten on the 313-314 loop?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>389371</commentid>
    <comment_count>4</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-11-13 07:44:53 +0000</bug_when>
    <thetext>SVN commit 480087 by hindenburg:

Remove jis7 from Encoding menu due to infinite loop.

CCBUG: 114535


 M  +3 -0      konsole.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #480086:480087
@@ -632,6 +632,9 @@
       selectSetEncoding = new KSelectAction( i18n( &quot;&amp;Encoding&quot; ), SmallIconSet( &quot;charset&quot; ), 0, this, SLOT(slotSetEncoding()), actions, &quot;set_encoding&quot; );
       QStringList list = KGlobal::charsets()-&gt;descriptiveEncodingNames();
       list.prepend( i18n( &quot;Default&quot; ) );
+
+      // BR114535 : Remove jis7 due to infinite loop.
+      list.remove( i18n( &quot;Japanese ( jis7 )&quot; ) );
       selectSetEncoding-&gt;setItems(list);
       selectSetEncoding-&gt;setCurrentItem (0);
       selectSetEncoding-&gt;plug(m_options);
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>389391</commentid>
    <comment_count>5</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2005-11-13 11:45:46 +0000</bug_when>
    <thetext>SVN commit 480103 by hindenburg:

Let&apos;s handle the jis7 problem this way.  That way the translators don&apos;t have
any new strings and I don&apos;t have to worry about the loading/saving not working
again.  It is too bad it is not possible to disable an item in a KSelectAction.

CCBUG: 107329
CCBUG: 114535


 M  +8 -6      konsole.cpp  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #480102:480103
@@ -632,11 +632,6 @@
       selectSetEncoding = new KSelectAction( i18n( &quot;&amp;Encoding&quot; ), SmallIconSet( &quot;charset&quot; ), 0, this, SLOT(slotSetEncoding()), actions, &quot;set_encoding&quot; );
       QStringList list = KGlobal::charsets()-&gt;descriptiveEncodingNames();
       list.prepend( i18n( &quot;Default&quot; ) );
-
-      // BR114535 : Remove jis7 due to infinite loop.
-      // If you fix this issue and remove the line below,  remember to 
-      // remove the line in setSessionEncoding() (search for jis7).
-      list.remove( i18n( &quot;Japanese ( jis7 )&quot; ) );
       selectSetEncoding-&gt;setItems(list);
       selectSetEncoding-&gt;setCurrentItem (0);
       selectSetEncoding-&gt;plug(m_options);
@@ -863,6 +858,14 @@
     bool found;
     QString enc = KGlobal::charsets()-&gt;encodingForName(selectSetEncoding-&gt;currentText());
     qtc = KGlobal::charsets()-&gt;codecForName(enc, found);
+
+    // BR114535 : Remove jis7 due to infinite loop.
+    if ( enc == &quot;jis7&quot; ) {
+      kdWarning()&lt;&lt;&quot;Encoding Japanese (jis7) currently does not work!  BR114535&quot;&lt;&lt;endl;
+      qtc = QTextCodec::codecForLocale();
+      selectSetEncoding-&gt;setCurrentItem( 0 );
+    }
+
     if(!found)
     {
       kdWarning() &lt;&lt; &quot;Codec &quot; &lt;&lt; selectSetEncoding-&gt;currentText() &lt;&lt; &quot; not found!&quot; &lt;&lt; endl;
@@ -2631,7 +2634,6 @@
     }
 
     i++;                 // Take into account the first entry: Default
-    if ( i &gt; 24 ) i--;   // Handle the removed jis7 entry
     //kdDebug()&lt;&lt;&quot;setSessionEncoding=&quot;&lt;&lt;encoding&lt;&lt;&quot;; &quot;&lt;&lt;i&lt;&lt;endl;
 
     session-&gt;setEncodingNo( i );
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>438322</commentid>
    <comment_count>6</comment_count>
    <who name="Kurt Hindenburg">khindenburg</who>
    <bug_when>2006-05-12 18:41:31 +0000</bug_when>
    <thetext>Not a crash since user can&apos;t pick jis7.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>537073</commentid>
    <comment_count>7</comment_count>
    <who name="Robert Knight">robertknight</who>
    <bug_when>2007-07-19 20:11:28 +0000</bug_when>
    <thetext>After commenting-out the jis7 check in konsole.cpp in the latest KDE 3.5 branch with Qt 3.3.7 and KDE 3.5.6 libraries I was able to run Konsole and pick the jis7 encoding without problems.  Is there anyone here who could double-check this with similar Qt,KDE versions and report on whether the problem still exists?

Index: konsole.cpp
===================================================================
--- konsole.cpp (revision 611528)
+++ konsole.cpp (working copy)
@@ -869,12 +869,14 @@
     QString enc = KGlobal::charsets()-&gt;encodingForName(selectSetEncoding-&gt;currentText());
     qtc = KGlobal::charsets()-&gt;codecForName(enc, found);

+# if 0
     // BR114535 : Remove jis7 due to infinite loop.
     if ( enc == &quot;jis7&quot; ) {
       kdWarning()&lt;&lt;&quot;Encoding Japanese (jis7) currently does not work!  BR114535&quot;&lt;&lt;endl;
       qtc = QTextCodec::codecForLocale();
       selectSetEncoding-&gt;setCurrentItem( 0 );
     }
+#endif

     if(!found)
     {
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1145892</commentid>
    <comment_count>8</comment_count>
    <who name="Jekyll Wu">adaptee</who>
    <bug_when>2011-07-26 21:22:21 +0000</bug_when>
    <thetext>This problem seems fixed in KDE4 konsole

Changing encoding to jis7 would not make konsole freeze when I start typing. 

I&apos;m using konsole-2.7.999</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>