Bug 135564

Summary: kig garbles special characters
Product: [Applications] kig Reporter: Jaka Kranjc <svn>
Component: generalAssignee: Pino Toscano <pino>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: screenshot

Description Jaka Kranjc 2006-10-13 10:23:29 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 4.0.3 
OS:                Linux

I added some labels to a sketch and two of them contain the greek alpha symbol α. But after opening the file the next day, alpha is replaced by some other chars (capital i with circumflex and +/-).

If I remove the first (magic) line, file confirms the kig file is "UTF-8 Unicode text". Opening it shows the same two bad symbols:
<Data type="string" id="2" >α</Data>
<Data type="string" id="16" >2α</Data>

So I deduce that something is wrong before writing the file already. The fact that two chars replaced one maybe shows that kig interprets the multibyte unicode char as two singlebyte chars (both those chars are ascii).
Comment 1 Jaka Kranjc 2006-10-13 10:24:39 UTC
Created attachment 18105 [details]
screenshot
Comment 2 Jaka Kranjc 2006-10-13 13:57:19 UTC
it's not that simple:
α  03B1
--------
Î  00CE
±  00B1
Comment 3 Pino Toscano 2006-11-23 01:32:34 UTC
SVN commit 607078 by pino:

Do not silently convert to an encoding different than UTF-8 when saving.

BUGS: 135564


 M  +1 -1      native-filter.cc  


--- branches/KDE/3.5/kdeedu/kig/filters/native-filter.cc #607077:607078
@@ -665,7 +665,7 @@
   docelem.appendChild( windowelem );
 
   doc.appendChild( docelem );
-  stream << doc.toCString();
+  stream << doc.toString();
   return true;
 }
 
Comment 4 Pino Toscano 2006-11-23 01:32:44 UTC
SVN commit 607079 by pino:

Do not silently convert to an encoding different than UTF-8 when saving.

CCBUG: 135564


 M  +1 -1      native-filter.cc  


--- branches/kig/post-kde-3.5/kig/filters/native-filter.cc #607078:607079
@@ -719,7 +719,7 @@
   docelem.appendChild( windowelem );
 
   doc.appendChild( docelem );
-  stream << doc.toCString();
+  stream << doc.toString();
   return true;
 }
 
Comment 5 Pino Toscano 2006-11-23 01:32:55 UTC
SVN commit 607080 by pino:

Do not silently convert to an encoding different than UTF-8 when saving.

CCBUG: 135564


 M  +1 -1      native-filter.cc  


--- trunk/KDE/kdeedu/kig/filters/native-filter.cc #607079:607080
@@ -722,7 +722,7 @@
   docelem.appendChild( windowelem );
 
   doc.appendChild( docelem );
-  stream << doc.toByteArray();
+  stream << doc.toString();
   return true;
 }